Convert Word to PDF programatically [C#] | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (173).NET Core  (29).NET MAUI  (207)Angular  (109)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (213)BoldSign  (14)DocIO  (24)Essential JS 2  (107)Essential Studio  (200)File Formats  (66)Flutter  (132)JavaScript  (220)Microsoft  (118)PDF  (81)Python  (1)React  (100)Streamlit  (1)Succinctly series  (131)Syncfusion  (911)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (51)Windows Forms  (61)WinUI  (68)WPF  (158)Xamarin  (161)XlsIO  (36)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (147)Chart  (130)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (63)Development  (623)Doc  (8)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (40)Extensions  (22)File Manager  (6)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (505)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (43)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (386)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (588)What's new  (329)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

Converting Word to PDF programmatically [C#]

Let’s learn how to convert a Word document to a PDF programmatically in C# without Microsoft Office or interop.

Syncfusion Word library (Essential DocIO) renders the contents of a Word document page by page and adds the contents of each page to the PDF document using Syncfusion PDF library. This converter can be easily integrated into .NET Framework (WinForms, WPF, ASP.NET Web forms, and ASP.NET MVC), ASP.NET Core, and Xamarin applications. It works well on both full trust and partial trust environments such as Azure applications.

This converter offers several options to customize Word to PDF conversion,

  • Embed complete or subset font information for TrueType fonts.
  • Substitute alternate fonts from the device or upload the original fonts.
  • PDF conformance level ‘PDF/A1B‘ or ‘PDF/X-1a:2001‘.
  • Convert accessible Word document (508 compliance) to Accessible or Tagged PDF
  • Export the headings or bookmarks in the Word document as PDF bookmarks.
  • Export the Word form fields as PDF form fields during Word to PDF conversion.
  • Adjust JPEG image quality and resolution for optimizing the converted PDF file size.

This converter supports all the elements of a typical Word document like text, formatting, images, tables, hyperlinks, fields, bookmarks, table of contents, shapes, headers, footers, etc. Refer to our documentation to know more about Word to PDF-conversion.

Steps to perform Word to PDF conversion programmatically in C# without Microsoft Office or interop:

  1. Create a new C# console application (.NET Framework) project.create-a-console-application-in-visual-studio
  2. Install DocToPDFConverter.WinForms NuGet package as a reference to your applications from This package contains Syncfusion libraries to perform Word to PDF conversion without Microsoft Office or interop.Note: 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.Add Syncfusion Word to PDF converter NuGet package reference to the project
  3. Include the following namespace in the Program.cs file.The following code snippet is used to open the Word document with DocIO.
    using Syncfusion.DocIO;
    using Syncfusion.DocIO.DLS;
    using Syncfusion.DocToPDFConverter;
    using Syncfusion.Pdf;
  4. Use the following code snippet to create Word file with simple text.
    //Get the path of existing Word document
    string fullpath = @".../../DocToPDF.docx";
    //Loads an existing Word document
    WordDocument wordDocument = new WordDocument(fullpath, FormatType.Docx);
    //Creates an instance of the DocToPDFConverter
    DocToPDFConverter converter = new DocToPDFConverter();
    //Converts Word document into PDF document
    PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);
    //Releases all resources used by DocToPDFConverter
    //Closes the instance of document objects
    //Saves the PDF file 
    //Closes the instance of document objects

    The following screenshot illustrates the input Word document.

    Input Word document to perform Word to PDF conversion

The next screenshot shows the final PDF document converted from the Word document.

A complete working example of Word to PDF conversion can be downloaded from this GitHub Repository

An online link for Word to PDF conversion example.

If you want to convert the Word documents to PDF in Xamarin or ASP.NET Core applications or in Azure environment, please check the following pages.


Whether you need to convert a Word document to PDF in any .NET platform, the Syncfusion Word to PDF converter libraries makes work easier for .NET developers. Take a moment to peruse the Word to PDF conversion documentation, where you can find other options and features, all with code examples. If you are new to our DocIO library, it is highly recommended to follow our Getting Started documentation.

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

As always, your feedback is highly appreciated, so please do reach out in our comments. You can also contact us through our support forum or Direct-Trac. We are happy to assist you!

If you’re already a Syncfusion user, you can download the product setup on Direct-Trac. If you’re not yet a Syncfusion user, you can download a free, 30-day trial on our website.

This post was originally published on May 20, 2014.

If you like this post, we think you’ll also like:


Share this post:

Comments (3)

Comments. Shapes. Dynamic fields. Charts. are not supported
If we use printing word document, do these features are supported ?

Hi Kamel Gazzah,

This blog is published in 2014 that doesn’t include the recently added features. Please find the recent status of the mentioned features,

* Shapes – Predefined shapes are supported while converting DOCX and WordML format documents to PDF.
* Dynamic fields – Fields like page number, date time, IF, and more. Please refer our UG documentation page about fields for more information.
* Charts – Charts are supported from .NET framework 4.0 onwards while converting DOCX and WordML format documents to PDF.
* Comments – not supported

If we use printing word document, do these features are supported?

The supported features vary depending on the application used for printing the Word document. The supported features of printing the Word document using Syncfusion libraries are same as Word to PDF conversion.

Please refer our Word to PDF UG documentation page for latest features and more information about the supported features.

I always used a third-party tool for conversion. but instantly I read your blog and I found it well explanatory and useful. I will try it myself too.

Comments are closed.

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed