Add Syncfusion® Document SDK component in the Blazor application
18 Nov 20183 minutes to read
The Syncfusion® Document SDK code snippet utility for Visual Studio Code includes snippets for inserting Syncfusion® Document SDK components (PDF, Word, Excel, and PowerPoint) into the Blazor Application’s Razor code editor.
The Syncfusion® Document SDK code snippet is available from Essential Studio® 2026 Volume 1 (
v33.1.44).
Add a Syncfusion® Document SDK component
The instructions below guide you through the process of using the Syncfusion® Document SDK code snippet in your Blazor application.
-
In Visual Studio Code, open an existing Blazor Application or create a new Blazor Application.
-
Open the razor file you need and place the cursor at the required place where you want to add the Syncfusion® component.
-
You can find the Syncfusion® Document SDK component with various features by typing the sf prefix in the format shown below.
sf<Syncfusion component name> For example, sfpdf -
Choose the Syncfusion® Document SDK component (PDF, Word, Excel, or PowerPoint) and press the Enter or Tab key. The Syncfusion® Document SDK component will be added in the razor file.

-
After adding the Syncfusion® Document SDK component to the razor file, use the Tab key to fill in the required values to render the component with data. You can find the comment section in the code snippet to see what values are required.

-
You can also find the Syncfusion help link at the top of the added snippet to learn more about the Syncfusion® Document SDK component.

Configure Blazor application with Syncfusion Document SDK
The Syncfusion® Document SDK snippet simply inserts the code into the razor file. You must configure the Blazor application with Syncfusion® by installing the Syncfusion® Blazor NuGet package, adding the namespace, themes, and registering the Syncfusion® Blazor Service. To configure, follow the steps below:
-
Open the Blazor application file and manually add the required Syncfusion® Blazor individual NuGet package(s) for the Syncfusion® Blazor components as a package reference. Refer to this section to learn about the advantages of the individual NuGet packages. This NuGet package will be automatically restored when building the application.

Starting with Volume 4, 2020 (v18.4.0.30) release, Syncfusion® provides individual NuGet packages for our Syncfusion® Blazor components. We highly recommend this new standard for your Blazor production applications.
-
To render the Syncfusion® components in your application, open the ~/_Imports.razor file and add the required Syncfusion® Blazor namespace entries.

-
Add the Syncfusion® Blazor theme in the
<head>element of the ~/Components/App.razor page for a Web App, in the<head>element of the ~/Pages/_Host.html page for a server application, and in the<head>element of the ~/wwwroot/index.html page for a client application.
-
Open the ~/Program.cs file (for Web App, server application, and client application) and register the Syncfusion® Blazor Service.
If you select an Interactive render mode as WebAssembly or Auto, you need to register the Syncfusion® Blazor service in both ~/Program.cs files of your Blazor Web App.

- If you installed the trial setup or NuGet packages from nuget.org you must register the Syncfusion® license key to your application since Syncfusion® introduced the licensing system from 2018 Volume 2 (v16.2.0.41) Essential Studio® release. Navigate to the help topic to generate and register the Syncfusion® license key to your application. Refer to this UG topic for understanding the licensing details in Essential Studio® for Document SDK.