You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/NET/Create-PDF-document-in-Blazor.md
+21-24Lines changed: 21 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,14 @@ description: Learn how to create or generate a PDF file in Blazor applications w
4
4
platform: document-processing
5
5
control: PDF
6
6
documentation: UG
7
+
keywords: blazor pdf, pdf generation, document creation, blazor server, blazor wasm, pdf library
7
8
---
8
9
9
10
# Create or Generate PDF file in Blazor
10
11
11
-
The Syncfusion<sup>®</sup> [Blazor PDF library](https://www.syncfusion.com/document-processing/pdf-framework/blazor/pdf-library)is used to create, read, and edit PDF documents. This library also offers functionality to merge, split, stamp, forms, and secure PDF files.
12
+
The Syncfusion<sup>®</sup> [Blazor PDF library](https://www.syncfusion.com/document-processing/pdf-framework/blazor/pdf-library)creates, reads, and edits PDF documents. This library also offers functionality to merge, split, stamp, forms, and secure PDF files.
12
13
13
-
To include the Syncfusion<sup>®</sup> Blazor PDF library into your Blazor application, please refer to the [NuGet Package Required](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/nuget-packages-required) or [Assemblies Required](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/assemblies-required) documentation.
14
+
To include the Syncfusion<sup>®</sup> Blazor PDF library into Blazor applications, refer to the [NuGet Package Required](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/nuget-packages-required) or [Assemblies Required](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/assemblies-required) documentation.
14
15
15
16
To quickly get started with creating a PDF document in Blazor, check this video:
@@ -31,20 +32,18 @@ To quickly get started with creating a PDF document in Blazor, check this video:
31
32
{% endtabcontent %}
32
33
{% endtabcontents %}
33
34
34
-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Getting%20Started/Blazor/ServerSideApplication).
35
+
A complete working sample is available from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Getting%20Started/Blazor/ServerSideApplication).
35
36
36
-
By executing the program, you will get the following output in the browser.
37
+
The following output appears in the browser after executing the program.
37
38

38
39
39
-
Click the Export to PDF button, and you will get the PDF document with the following output.
40
+
Click the Export to PDF button to obtain the PDF document with the following output.
40
41

41
42
42
-
N> It is recommended to use Blazor Server-Side application to reduce the pay back load which is high in Blazor Client-Side.
43
+
N> Server-Side Blazor applications are recommended to reduce the payload, which is high in Blazor Client-Side applications.
43
44
44
45
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/blazor) to explore the rich set of Syncfusion<sup>®</sup> PDF library features.
45
46
46
-
An online sample link to [create PDF document](https://blazor.syncfusion.com/demos/pdf/hello-world?theme=fluent) in Blazor.
47
-
48
47
## Steps to create PDF document in Blazor WASM application
49
48
50
49
{% tabcontents %}
@@ -61,18 +60,16 @@ An online sample link to [create PDF document](https://blazor.syncfusion.com/dem
61
60
{% endtabcontent %}
62
61
{% endtabcontents %}
63
62
64
-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Getting%20Started/Blazor/ClientSideApplication).
63
+
A complete working sample is available from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Getting%20Started/Blazor/ClientSideApplication).
65
64
66
-
By executing the program, you will get the following output in the browser.
65
+
The following output appears in the browser after executing the program.
Click the Export to PDF button and you will get the PDF document with the following output.
68
+
Click the Export to PDF button to obtain the PDF document with the following output.
70
69

71
70
72
71
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/blazor) to explore the rich set of Syncfusion<sup>®</sup> PDF library features.
73
72
74
-
An online sample link to [create PDF document](https://blazor.syncfusion.com/demos/pdf/hello-world?theme=fluent) in Blazor.
75
-
76
73
## Steps to create PDF documents in .NET MAUI Blazor application
77
74
78
75
{% tabcontents %}
@@ -89,13 +86,13 @@ An online sample link to [create PDF document](https://blazor.syncfusion.com/dem
89
86
{% endtabcontent %}
90
87
{% endtabcontents %}
91
88
92
-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Getting%20Started/Blazor/BlazorMauiAppCreatePdfSample).
89
+
A complete working sample is available from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Getting%20Started/Blazor/BlazorMauiAppCreatePdfSample).
93
90
94
-
By running the program, you will see the output in the browser when you click the "Whether" option in the left-side menu.
91
+
The following output appears in the browser when clicking the "Weather" option in the left-side menu.
Click the `Export to PDF` button to get the PDF document with the following output.
98
-

94
+
Click the `Export to PDF` button to obtain the PDF document with the following output.
95
+

99
96
100
97
### Save the PDF document on different platforms
101
98
@@ -114,9 +111,9 @@ Create a folder named `Services`, then add a class called `SaveService.cs` withi
114
111
115
112
{% endtabs %}
116
113
117
-
Now, we need to implement platform-specific code to save the PDF document.
114
+
Platform-specific code implementation is required to save the PDF document across different platforms.
118
115
119
-
#### Andriod
116
+
#### Android
120
117
Create a new class file named `SaveAndroid.cs` within the Android folder and add the following code to enable file saving on the Android platform.
121
118
122
119
{% tabs %}
@@ -187,7 +184,7 @@ Create a new class file named `SaveAndroid.cs` within the Android folder and add
187
184
188
185
{% endtabs %}
189
186
190
-
N> Introduced a new runtime permission model for the Android SDK version 23 and above. So, include the following code for enabling the Android file provider to save and view the generated PDF document.
187
+
N> The Android SDK version 23 and above introduced a new runtime permission model. Include the following code for enabling the Android file provider to save and view the generated PDF document.
191
188
192
189
1. Create a new XML file with the name of `file_paths.xml` under the Android project Resources/xml folder and add the following code in it.
193
190
@@ -245,7 +242,7 @@ N> Introduced a new runtime permission model for the Android SDK version 23 and
245
242
246
243
{% endtabs %}
247
244
248
-
#### IOS
245
+
#### iOS
249
246
Create a new class file named `SaveIOS.cs` within the iOS folder and include the following code to enable file saving on the iOS platform.
250
247
251
248
{% tabs %}
@@ -286,8 +283,8 @@ Create a new class file named `SaveIOS.cs` within the iOS folder and include the
286
283
287
284
{% endtabs %}
288
285
289
-
#### MacOS
290
-
Create a new class file named `SaveMac.cs` within the MacCatalyst folder and include the following code to enable file saving on the MacOS platform.
286
+
#### macOS
287
+
Create a new class file named `SaveMac.cs` within the MacCatalyst folder and include the following code to enable file saving on the macOS platform.
291
288
292
289
{% tabs %}
293
290
@@ -452,6 +449,6 @@ Create a new class file named `SaveWindows.cs` within the Windows folder and inc
452
449
453
450
{% endtabs %}
454
451
455
-
The helper files mentioned above are available on [this](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/create-pdf-file-in-maui#helper-files-for-net-maui) page. You can refer to [this](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/create-pdf-file-in-maui#helper-files-for-net-maui) page for more details.
452
+
The helper files mentioned above are available on [this](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/create-pdf-file-in-maui#helper-files-for-net-maui) page. Refer to [this](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/create-pdf-file-in-maui#helper-files-for-net-maui) page for more details.
456
453
457
454
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/blazor) to explore the rich set of Syncfusion<sup>®</sup> PDF library features.
Copy file name to clipboardExpand all lines: Document-Processing/PDF/PDF-Library/NET/Loading-and-saving-document/Open-and-save-PDF-document-in-Blazor.md
+16-25Lines changed: 16 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,20 +9,12 @@ keywords: blazor save pdf, blazor load pdf, c# save pdf, c# load pdf
9
9
10
10
# Open and save PDF document in Blazor
11
11
12
-
The [Syncfusion<sup>®</sup> Blazor PDF library](https://www.syncfusion.com/document-processing/pdf-framework/blazor)is used to create, read, and edit PDF documents programmatically without the dependency of Adobe Acrobat. Using this library, you can **open and save PDF document in ASP.NET Core**.
12
+
The [Syncfusion<sup>®</sup> Blazor PDF library](https://www.syncfusion.com/document-processing/pdf-framework/blazor)creates, reads, and edits PDF documents programmatically without the dependency of Adobe Acrobat. Using this library, **open and save PDF documents in ASP.NET Core**.
13
13
14
14
**Prerequisites:**
15
15
16
-
* Visual Studio 2019 Preview
17
-
* Install the [.NET Core SDK 3.1 Preview](https://dotnet.microsoft.com/en-us/download/dotnet/3.1)
18
-
19
-
**Creating a Blazor project**
20
-
21
-
* Enable Visual Studio to use preview SDKs.
22
-
* Open Tools > Options in the menu bar.
23
-
* Open the Projects and Solutions node. Open the .NET Core tab.
24
-
* Check the box for Use previews of the .NET Core SDK and click OK.
25
-
* Restart the Visual Studio 2019.
16
+
* Visual Studio 2022 or later
17
+
* Install the [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) or later
26
18
27
19
## Server app
28
20
@@ -35,9 +27,9 @@ Step 2: In the **Interactive Render Mode section**, choose `Server` as the rende
35
27
Step 3: To **open and save a PDF document in Blazor Server app**, install [Syncfusion.Pdf.Net.Core](https://www.nuget.org/packages/Syncfusion.pdf.Net.Core) to the Blazor project.
N> Starting with v16.2.0.x, if you reference Syncfusion<sup>®</sup> assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion<sup>®</sup> license key in your application to use our components.
30
+
N> Starting with v16.2.0.x, if referencing Syncfusion<sup>®</sup> assemblies from trial setup or from the NuGet feed, add "Syncfusion.Licensing" assembly reference and include a license key in projects. Refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to learn about registering Syncfusion<sup>®</sup> license key in applications to use the components.
39
31
40
-
Step 4: Inject ExportService into `FetchData.razor` using the following code.
32
+
Step 4: Inject ExportService into `FetchData.razor` using the following code.
41
33
42
34
{% tabs %}
43
35
{% highlight c# tabtitle="C#" %}
@@ -94,7 +86,7 @@ using System.IO;
94
86
95
87
{% endtabs %}
96
88
97
-
Step 8: Register your service in the `ConfigureServices` method available in the `Startup.cs` class as follows.
89
+
Step 8: Register the service in the `ConfigureServices` method available in the `Startup.cs` class as follows.
98
90
99
91
{% tabs %}
100
92
@@ -228,9 +220,8 @@ Step 13: Add the following JavaScript function in the `_Host.cshtml` available u
228
220
229
221
{% endtabs %}
230
222
231
-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Open%20and%20Save%20PDF%20document/Blazor/ServerSideApplication).
232
-
233
-
By executing the program, you will get the **PDF document** as follows.
223
+
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Open%20and%20Save%20PDF%20document/Blazor/ServerSideApplication).A complete working sample is available from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Open%20and%20Save%20PDF%20document/Blazor/ServerSideApplication).
224
+
The following output appears after executing the program.
234
225

235
226
236
227
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/blazor) to explore the rich set of Syncfusion<sup>®</sup> PDF library features.
@@ -243,10 +234,10 @@ Step 1: Create a new C# Blazor server-side application project. Select **Blazor
243
234
Step 2: In the **Interactive Render Mode section**, choose `WebAssembly` as the render mode. Then, click the `Create` button to generate a new Blazor client-Side Application.
Step 3: Install the [Syncfusion.PDF.Net.Core](https://www.nuget.org/packages/Syncfusion.pdf.Net.Core) NuGet package as a reference to your Blazor application from [NuGet.org](https://www.nuget.org/).
237
+
Step 3: Install the [Syncfusion.PDF.Net.Core](https://www.nuget.org/packages/Syncfusion.pdf.Net.Core) NuGet package as a reference to the Blazor application from [NuGet.org](https://www.nuget.org/).
Step 4: Next, include the following namespaces in that`FetchData.razor` file.
240
+
Step 4: Include the following namespaces in the`FetchData.razor` file.
250
241
251
242
{% tabs %}
252
243
@@ -274,7 +265,7 @@ Step 5: Create a button in the `FetchData.razor` using the following code.
274
265
275
266
{% endtabs %}
276
267
277
-
Step 6: Create a new async method with name as ``LoadAndSavePDF`` and include the following code snippet to **open an existing PDF document in Blazor** WASM app.
268
+
Step 6: Create a new async method with name as `LoadAndSavePDF` and include the following code snippet to **open an existing PDF document in Blazor** WASM app.
278
269
279
270
{% tabs %}
280
271
@@ -391,13 +382,13 @@ Step 10: Add the following JavaScript function in the `index.html` available und
391
382
392
383
{% endtabs %}
393
384
394
-
You can download a complete working sample from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Open%20and%20Save%20PDF%20document/Blazor/ClientSideApplication).
385
+
A complete working sample is available from [GitHub](https://github.com/SyncfusionExamples/PDF-Examples/tree/master/Open%20and%20Save%20PDF%20document/Blazor/ClientSideApplication).
395
386
396
-
By executing the program, you will get the **PDF document** as follows.
397
-

387
+
The following output appears after executing the program.
388
+

398
389
399
-
N> Even though PDF library works in WASM app, it is recommended to use server deployment. Since the WASM app deployment increases the application payload size.
390
+
N> Even though PDF library works in WASM app, server deployment is recommended. Since the WASM app deployment increases the application payload size.
400
391
401
-
Kindly explore the [supported and unsupported features of PDF library in Blazor](https://www.syncfusion.com/document-processing/pdf-framework/blazor/pdf-library).
392
+
Explore the [supported and unsupported features of PDF library in Blazor](https://www.syncfusion.com/document-processing/pdf-framework/blazor/pdf-library).
402
393
403
394
Click [here](https://www.syncfusion.com/document-processing/pdf-framework/blazor) to explore the rich set of Syncfusion<sup>®</sup> PDF library features.
0 commit comments