Articles in this section
Category / Section

How to convert a Word document to PDF in ASP.NET Core?

2 mins read

Syncfusion Essential DocIO Renderer is a .NET Core Word to PDF conversion library (Essential DocIO and Essential PDF) used to convert Word documents to PDF in ASP.NET Core application [C#].

Steps to convert Word document to PDF programmatically in ASP.NET Core:

  1. Create new C# .NET Core console application.

Create .NET Core Web application in Visual Studio in ASP.NET Core Word

  1. Install the Syncfusion.DocIORenderer.NET.Core NuGet package as a reference to your .NET Core application from

Add DocIO Renderer NuGet package reference to the project in ASP.NET Core Word

  1. Include the following namespace in the Program.cs file.


using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;
using System.IO;
  1. Use the following code snippet to create Word document with “Hello World” text and convert Word document to PDF.


//Creates a new Word document.
WordDocument wordDocument = new WordDocument();
//Add a section & a paragraph in the empty document.
//Append text to the last paragraph of the document.
wordDocument.LastParagraph.AppendText("Hello World...!");
//Create instance for DocIORenderer for Word to PDF conversion
DocIORenderer render = new DocIORenderer();
//Converts Word document to PDF.
PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
//Release the resources used by the Word document and DocIO Renderer objects.
//Saves the PDF file.
FileStream outputStream = new FileStream(@"Ouput.pdf", FileMode.CreateNew, FileAccess.Write);
//Closes the instance of PDF document object.
//Dispose the instance of FileStream.

A complete working example of how to convert Word document to PDF using .NET Core Word library can be downloaded from WordToPDF_Example.Zip.

By executing the example program, you will get the PDF document as like below.

Converted PDF document in ASP.NET Core Word

Take a moment to peruse the documentation, where you can find other file format conversions with code examples and the procedure to deploy the application in Linux OS.

Explore more about the rich set of Syncfusion Word Framework features.

An online example to convert Word document to PDF in ASP.NET Core web application.


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.



I hope you enjoyed learning about how to convert a Word document to PDF in ASP.NET Core.

You can refer to our ASP.NET Core Word feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET Core Word example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Please sign in to leave a comment