Examples

Convert Word to PDF

Easily convert a Microsoft Word file to a PDF document using DynamicPDF Converter for .NET. The following C# examples show you how.

Watch the Video

How to Convert Word to PDF

The easiest way to convert a Word (docx or doc) file to a PDF is by calling the static Convert method of the Converter class. But DynamicPDF Converter for .NEt also provides the WordConverter class and WordConversionOptions classe to customize conversion.


Steps to Convert DOCX/DOC to PDF (using static Convert method)


  1. Use the static Convert method of the Converter class and pass the path to the Word document to convert and the path to the PDF document to create.

Sample Code - C#


Converter.Convert("sample.docx", "output.pdf")

Steps to Convert DOCX/DOC to PDF (using WordConverter)


  1. Create a new WordConverter object instance and in the constructor specify the path to the Word file.
  2. Add the Convert method on the WordConverter instance and specify the path to the PDF file to create.

Sample Code - C#


WordConverter wordDocConverter = new WordConverter(Program.GetResourcePath("sample.doc");
wordDocConverter.Convert("output.pdf");

Steps to Convert DOCX/DOC to PDF (using WordConverter and WordConversionOptions)


  1. Create a new WordConversionOptions object instance.
  2. Set the top, bottom, left, and right margins.
  3. Create a new WordConverter object instance and in the constructor specify the path to the Word file and the WordConversionOptions instance.
  4. Add the Convert method on the WordConverter instance and specify the path to the PDF file to create.

Sample Code - C#


WordConversionOptions options = new WordConversionOptions();
options.Author = "John Doe";
options.TopMargin = 144;
options.BottomMargin = 72;
options.LeftMargin = 72;
options.RightMargin = 72;
WordConverter wordDocConverter = new WordConverter("sample.doc", options);
wordDocConverter.Convert("output.pdf");

GitHub Project

Examples are provided in C# and VB.NET. Clone or view the example project at GitHub.


Clone or View Example Project on GitHub

Getting Started


Get started easily by installing DynamicPDF Converter for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing.


NuGet Package


The easiest way to install DynamicPDF Converter for .NET is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.

NuGet Package ID: ceTe.DynamicPDF.Converter.NET


More Information on Word Conversion



DynamicPDF Converter Information


DynamicPDF Converter for .NET allows any .NET developer to dynamically convert many common file formats to PDF documents in real-time. It supports converting over 50 file types to PDF, including HTML and MS Office formats. The software supports events, enabling developers to easily and accurately handle both successful and failed conversions. It is intuitive and seamlessly integrates with all our DynamicPDF products. With a Free Evaluation Edition to try, why not start using DynamicPDF Converter Today!


More information on DynamicPDF Converter for .NET

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!