PDF (portable document format) is a standardized format used to present document contents uniformly across various platforms. The Syncfusion .NET Word Library (DocIO) offers powerful APIs for programmatically converting Word documents to PDF with minimal code in C#, without Microsoft Word or interop dependencies. Additionally, it facilitates converting Word documents to PDF/A format for archival purposes and tagged PDFs compliant with Section 508 (PDF/UA).
This example code shows how to convert a Word document to PDF using the Syncfusion .NET Word Library with just few lines of code in C#.
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;
//Open the Word document file stream
using (FileStream fileStream = new FileStream("Template.docx", FileMode.Open))
{
//Load an existing Word document
using (WordDocument wordDocument = new WordDocument(fileStream, FormatType.Automatic))
{
//Create an instance of DocIORenderer
using (DocIORenderer renderer = new DocIORenderer())
{
//Convert Word document into PDF document
using (PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument))
{
//Save the PDF file to file system
using (FileStream outputStream = new FileStream("WordToPDF.pdf", FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))
{
pdfDocument.Save(outputStream);
}
}
}
}
}
Design an accessible Word document (508-compliant) using Microsoft Word or the Syncfusion .NET Word Library and convert it to an accessible or tagged PDF (PDF/UA) document.
Configure the conformance level of your converted PDF for long-term archiving and standardization.
Design your application forms as Word documents using Microsoft Word and convert them to fillable PDF forms using the Syncfusion .NET Word Library.
Import or ignore the embedded alternate chunks (other Word documents) in a document when converting it to PDF.
Export the paragraphs with heading styles or bookmarks as PDF bookmarks.
Enable the settings to reduce main memory usage during Word-to-PDF conversion by reusing identical images in the Word document.
Enables the addition of hyphens to text within a Word document during Word-to-PDF conversion, using specified language dictionaries.
Preserve revision marks in the converted PDF, retaining tracked changes from the Word document and offering customization options for track changes markup.
Preserve comment balloons in the converted PDF from the Word document. Also, customize balloon colors for enhanced visual clarity.
Embeds only the font glyphs from TrueType fonts that are used in the document.
Embeds the complete set of TrueType fonts used in the document and allows displaying of the document contents uniformly and independent of whether the font is available or not.
The built-in font substitution event allows users to choose alternate fonts from the device or upload fonts with a few lines of code.
Allows the configuration of fallback fonts for Unicode text. These fallback fonts come into play when the rendering engine encounters Unicode text that lacks a corresponding glyph in the specified fonts.
Discover these resources from our knowledge base to enhance your efficiency in converting Word documents to PDF:
Knowledge base
Knowledge base
Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.
Product Updates
Technical Support
Word file formats such as DOC, DOT, DOCX, DOTX, DOCM, DOTM, Word Processing 2007 XML, Word 2003 XML Document (*.xml), as well as other formats including HTML, text, and Markdown are supported.
Yes, you can perform Word-to-PDF conversion in Linux and different cloud platforms like Azure, Amazon Web Services, and Google Cloud Platform using the .NET Word Library.
If required fonts aren’t installed, Word Library uses alternatives, possibly causing differences in generated PDFs. Refer to the documentation for solutions to resolve this issue.
Yes, you can programmatically open password-protected Word documents and convert them to PDF using the .NET Word Library.
The .NET Word Library supports converting Word documents to tagged PDFs, ensuring Section 508 compliance for users relying on assistive technologies.
You can access it through the Syncfusion.DocIORenderer.Net.Core NuGet package. Detailed code samples and tutorial video are available in the documentation.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.