Converting Word docs to PDFs

Let’s learn how to convert a Word document to a PDF using Essential DocIO and Essential PDF.

Essential DocIO renders the contents of a Word document page by page and adds each page to the PDF document using Essential PDF. Use the ConvertToPDF method of the DocToPDFConverter class to convert the WordDocument instance to a PdfDocument instance, and save the PDF document using Essential PDF.

Please note that this conversion support is available only for the following .NET platforms:

  • Windows Forms
  • WPF
  • ASP.NET Web
  • ASP.NET MVC

Note: Doc-to-PDF conversion works only in Full Trust Mode for the above platforms.

Please refer to the following user guide links for more details on Essential DocIO and Essential PDF:

The following code snippet is used to open the Word document with DocIO.

//Opens the Word template document.
WordDocument wordDoc = new WordDocument(fullPath);

These snippets are used to convert the Word document into a PDF.

//Create a new instance to convert the Word document.
DocToPDFConverter converter = new DocToPDFConverter();
//Convert the Word document into a PDF document.
PdfDocument pdfDoc = converter.ConvertToPDF(wordDoc);

You can save the converted PDF document into a file system using Essential PDF.

The following code snippet is used to save the converted PDF document into a file system.

//Save the PDF file.
pdfDoc.Save("DoctoPDF.pdf");

The following screenshot illustrates the input Word template document.

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

You can save the converted PDF document to the file system or file stream in order to store it in a database. It can also be streamed to the client browser in web applications.

Doc-to-PDF conversion supports the following Word elements:

  • Paragraph and character formatting.
  • Multicolumn text.
  • Headers and footers.
  • Bulleted, numbered, and multilevel lists.
  • Images.
  • Tables (both simple and nested).
  • Table styles for .docx formats.
  • Breaks (page, section, line break, etc.).
  • OLE Objects.
  • Textboxes.
  • Page settings and background images.
  • Document properties.
  • Tables of contents.
  • Bookmarks.
  • Hyperlinks.
  • Footnotes and endnotes.
  • AutoShapes for .docx formats.

The following unsupported elements will not be preserved in the generated PDF document.

Comments. Shapes. Dynamic fields. Charts.

For more information on Doc-to-PDF conversion, please refer to the following user guide link:

http://help.syncfusion.com/ug/asp.net/docio/default.htm#!documents/doctopdf.htm

Share this post:

Comments (2)

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.
https://help.syncfusion.com/file-formats/docio/working-with-fields#updating-fields
* 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.

https://help.syncfusion.com/file-formats/docio/word-to-pdf

Leave a comment