Skip to content

Commit 436c0f7

Browse files
master: PDF conversion API
1 parent accb27c commit 436c0f7

File tree

7 files changed

+294
-247
lines changed

7 files changed

+294
-247
lines changed

Angular/src/app/demo-api/demo-api.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,43 +32,43 @@ export class DemoApiComponent {
3232
switch (buttonType) {
3333
case 'ConvertToPdf':
3434

35-
response = await fetch("https://localhost:7019/api/Product/ConvertToPdf", {
35+
response = await fetch("https://localhost:7019/api/PdfConversion/ConvertToPdf", {
3636
method: 'POST',
3737
body: formData
3838
})
3939

4040
break;
4141
case 'ConvertHtmlToPdf':
4242

43-
response = await fetch("https://localhost:7019/api/Product/HtmlToPdf", {
43+
response = await fetch("https://localhost:7019/api/PdfConversion/HtmlToPdf", {
4444
method: 'POST',
4545
body: formData
4646
})
4747

4848
break;
4949
case 'ConvertWordToPdf':
50-
response = await fetch("https://localhost:7019/api/Product/WordToPdf", {
50+
response = await fetch("https://localhost:7019/api/PdfConversion/WordToPdf", {
5151
method: 'POST',
5252
body: formData
5353
})
5454

5555
break;
5656
case 'ConvertExcelToPdf':
57-
response = await fetch("https://localhost:7019/api/Product/ExcelToPdf", {
57+
response = await fetch("https://localhost:7019/api/PdfConversion/ExcelToPdf", {
5858
method: 'POST',
5959
body: formData
6060
})
6161

6262
break;
6363
case 'ConvertPptxToPdf':
64-
response = await fetch("https://localhost:7019/api/Product/PptxToPdf", {
64+
response = await fetch("https://localhost:7019/api/PdfConversion/PptxToPdf", {
6565
method: 'POST',
6666
body: formData
6767
})
6868

6969
break;
7070
case 'ConvertImageToPdf':
71-
response = await fetch("https://localhost:7019/api/Product/ImageToPdf", {
71+
response = await fetch("https://localhost:7019/api/PdfConversion/ImageToPdf", {
7272
method: 'POST',
7373
body: formData
7474
})

Blazor/Pages/Index.razor

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Enter your document for pdf conversion.
5151
var content = new MultipartFormDataContent();
5252
content.Add(new StreamContent(file.OpenReadStream()), "file", fileName);
5353
client.BaseAddress = new Uri("https://localhost:7019/");
54-
var response = await client.PostAsync("/api/Product/ConvertToPdf", content);
54+
var response = await client.PostAsync("/api/PdfConversion/ConvertToPdf", content);
5555
DownloadPdf(response, fileName);
5656
}
5757

@@ -62,7 +62,7 @@ Enter your document for pdf conversion.
6262
var content = new MultipartFormDataContent();
6363
content.Add(new StreamContent(file.OpenReadStream()), "file", fileName);
6464
client.BaseAddress = new Uri("https://localhost:7019/");
65-
var response = await client.PostAsync("/api/Product/HtmlToPdf", content);
65+
var response = await client.PostAsync("/api/PdfConversion/HtmlToPdf", content);
6666
DownloadPdf(response, fileName);
6767
}
6868

@@ -73,7 +73,7 @@ Enter your document for pdf conversion.
7373
var content = new MultipartFormDataContent();
7474
content.Add(new StreamContent(file.OpenReadStream()), "file", fileName);
7575
client.BaseAddress = new Uri("https://localhost:7019/");
76-
var response = await client.PostAsync("/api/Product/WordToPdf", content);
76+
var response = await client.PostAsync("/api/PdfConversion/WordToPdf", content);
7777
DownloadPdf(response, fileName);
7878
}
7979

@@ -84,7 +84,7 @@ Enter your document for pdf conversion.
8484
var content = new MultipartFormDataContent();
8585
content.Add(new StreamContent(file.OpenReadStream()), "file", fileName);
8686
client.BaseAddress = new Uri("https://localhost:7019/");
87-
var response = await client.PostAsync("/api/Product/ExcelToPdf", content);
87+
var response = await client.PostAsync("/api/PdfConversion/ExcelToPdf", content);
8888
DownloadPdf(response, fileName);
8989
}
9090

@@ -95,7 +95,7 @@ Enter your document for pdf conversion.
9595
var content = new MultipartFormDataContent();
9696
content.Add(new StreamContent(file.OpenReadStream()), "file", fileName);
9797
client.BaseAddress = new Uri("https://localhost:7019/");
98-
var response = await client.PostAsync("/api/Product/PptxToPdf", content);
98+
var response = await client.PostAsync("/api/PdfConversion/PptxToPdf", content);
9999
DownloadPdf(response, fileName);
100100
}
101101

@@ -106,7 +106,7 @@ Enter your document for pdf conversion.
106106
var content = new MultipartFormDataContent();
107107
content.Add(new StreamContent(file.OpenReadStream()), "file", fileName);
108108
client.BaseAddress = new Uri("https://localhost:7019/");
109-
var response = await client.PostAsync("/api/Product/ImageToPdf", content);
109+
var response = await client.PostAsync("/api/PdfConversion/ImageToPdf", content);
110110
DownloadPdf(response, fileName);
111111
}
112112

README.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# PDF_Conversion_API
1+
# PDF Conversion API
22
PDF Conversion API
3-
This demo illustrates how to converting various file formats like HTML file to PDF, Word file to PDF, Excel file to PDF, Presentation file to PDF and Image to PDf your Web application.
3+
This API illustrates how to converting various file formats like HTML file to PDF, Word file to PDF, Excel file to PDF, Presentation file to PDF and Image to PDf your Web application.
44

55
## Demo illustration
66

@@ -9,37 +9,84 @@ This demo illustrates how to converting various file formats like HTML file to P
99
1. Click the "Choose File" button to select the file you want to convert.
1010

1111
## Conversion Options
12+
The following code snippet is used to convert various files to PDF in Angular framework.
13+
1214
### Convert to PDF
1315
- Select any file (e.g., xls, xlsx, docx, html, jpg).
1416
- Choose the "Convert to PDF" option.
1517
- This help to convert Any file format to PDF.
18+
```c#
19+
response = await fetch("https://localhost:7019/api/PdfConversion/ConvertToPdf", {
20+
method: 'POST',
21+
body: formData
22+
})
23+
24+
```
1625

1726
### Excel to PDF
1827

1928
- Select the Excel file (e.g., xls, xlsx).
2029
- Choose the "Convert Excel to PDF" option.
30+
```c#
31+
response = await fetch("https://localhost:7019/api/PdfConversion/ExcelToPdf", {
32+
method: 'POST',
33+
body: formData
34+
})
35+
36+
```
2137

2238
### Word to PDF
2339

2440
- Select the Word document.
2541
- Choose the "Convert Word to PDF" option.
42+
```c#
43+
response = await fetch("https://localhost:7019/api/PdfConversion/WordToPdf", {
44+
method: 'POST',
45+
body: formData
46+
})
47+
48+
```
2649

2750
### Presentation to PDF
2851

2952
- Select the presentation file (e.g., pptx).
3053
- Choose the "Convert Pptx to PDF" option.
54+
```c#
55+
response = await fetch("https://localhost:7019/api/PdfConversion/PptxToPdf", {
56+
method: 'POST',
57+
body: formData
58+
})
59+
60+
```
3161

3262
### HTML to PDF
3363

3464
- Select the HTML file.
3565
- Choose the "Convert HtML to PDF" option.
66+
```c#
67+
response = await fetch("https://localhost:7019/api/PdfConversion/HtmlToPdf", {
68+
method: 'POST',
69+
body: formData
70+
})
71+
72+
```
3673

3774
### Image to PDF
3875

3976
- Select the image file (e.g., JPEG, PNG,JPG).
4077
- Choose the "Convert Image to PDF" option.
78+
```c#
79+
response = await fetch("https://localhost:7019/api/PdfConversion/ImageToPdf", {
80+
method: 'POST',
81+
body: formData
82+
})
83+
84+
```
4185

4286
## Conclusion
4387

44-
By following these conversation-based options, you can easily convert various file formats to PDF. Remember to review and save the converted PDF files in your desired location.
88+
By following these conversation-based options, you can easily convert various file formats to PDF in various platforms. Remember to review and save the converted PDF files in your desired location.
89+
90+
91+
4592

React/src/convertPdf/ConvertToPdf.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function ConvertToPdf() {
1818
try {
1919
const formData = new FormData();
2020
formData.append('file', file);
21-
let response = await fetch("https://localhost:7019/api/Product/ConvertToPdf", {
21+
let response = await fetch("https://localhost:7019/api/PdfConversion/ConvertToPdf", {
2222
method: 'POST',
2323
body: formData
2424
})
@@ -35,7 +35,7 @@ function ConvertToPdf() {
3535
try {
3636
const formData = new FormData();
3737
formData.append('file', file);
38-
let response = await fetch("https://localhost:7019/api/Product/HtmlToPdf", {
38+
let response = await fetch("https://localhost:7019/api/PdfConversion/HtmlToPdf", {
3939
method: 'POST',
4040
body: formData
4141
})
@@ -52,7 +52,7 @@ function ConvertToPdf() {
5252
try {
5353
const formData = new FormData();
5454
formData.append('file', file);
55-
let response = await fetch("https://localhost:7019/api/Product/WordToPdf", {
55+
let response = await fetch("https://localhost:7019/api/PdfConversion/WordToPdf", {
5656
method: 'POST',
5757
body: formData
5858
})
@@ -69,7 +69,7 @@ function ConvertToPdf() {
6969
try {
7070
const formData = new FormData();
7171
formData.append('file', file);
72-
let response = await fetch("https://localhost:7019/api/Product/ImageToPdf", {
72+
let response = await fetch("https://localhost:7019/api/PdfConversion/ImageToPdf", {
7373
method: 'POST',
7474
body: formData
7575
})
@@ -86,7 +86,7 @@ function ConvertToPdf() {
8686
try {
8787
const formData = new FormData();
8888
formData.append('file', file);
89-
let response = await fetch("https://localhost:7019/api/Product/PptxToPdf", {
89+
let response = await fetch("https://localhost:7019/api/PdfConversion/PptxToPdf", {
9090
method: 'POST',
9191
body: formData
9292
})
@@ -102,7 +102,7 @@ function ConvertToPdf() {
102102
try {
103103
const formData = new FormData();
104104
formData.append('file', file);
105-
let response = await fetch("https://localhost:7019/api/Product/ExcelToPdf", {
105+
let response = await fetch("https://localhost:7019/api/PdfConversion/ExcelToPdf", {
106106
method: 'POST',
107107
body: formData
108108
})

Vue/src/components/PdfConversion.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default{
1818
debugger;
1919
const formData = new FormData();
2020
formData.append('file', this.file);
21-
let response = await fetch("https://localhost:7019/api/Product/ConvertToPdf", {
21+
let response = await fetch("https://localhost:7019/api/PdfConversion/ConvertToPdf", {
2222
method: 'POST',
2323
body: formData
2424
})
@@ -29,7 +29,7 @@ export default{
2929
debugger;
3030
const formData = new FormData();
3131
formData.append('file', this.file);
32-
let response = await fetch("https://localhost:7019/api/Product/HtmlToPdf", {
32+
let response = await fetch("https://localhost:7019/api/PdfConversion/HtmlToPdf", {
3333
method: 'POST',
3434
body: formData
3535
})
@@ -40,7 +40,7 @@ export default{
4040
debugger;
4141
const formData = new FormData();
4242
formData.append('file', this.file);
43-
let response = await fetch("https://localhost:7019/api/Product/WordToPdf", {
43+
let response = await fetch("https://localhost:7019/api/PdfConversion/WordToPdf", {
4444
method: 'POST',
4545
body: formData
4646
})
@@ -51,7 +51,7 @@ export default{
5151
debugger;
5252
const formData = new FormData();
5353
formData.append('file', this.file);
54-
let response = await fetch("https://localhost:7019/api/Product/ImageToPdf", {
54+
let response = await fetch("https://localhost:7019/api/PdfConversion/ImageToPdf", {
5555
method: 'POST',
5656
body: formData
5757
})
@@ -62,7 +62,7 @@ export default{
6262
debugger;
6363
const formData = new FormData();
6464
formData.append('file', this.file);
65-
let response = await fetch("https://localhost:7019/api/Product/PptxToPdf", {
65+
let response = await fetch("https://localhost:7019/api/PdfConversion/PptxToPdf", {
6666
method: 'POST',
6767
body: formData
6868
})
@@ -74,7 +74,7 @@ export default{
7474
debugger;
7575
const formData = new FormData();
7676
formData.append('file', this.file);
77-
let response = await fetch("https://localhost:7019/api/Product/ExcelToPdf", {
77+
let response = await fetch("https://localhost:7019/api/PdfConversion/ExcelToPdf", {
7878
method: 'POST',
7979
body: formData
8080
})

0 commit comments

Comments
 (0)