ExpertPdf Anywhere v22.0.0

Word to PDF Converter for .NET

Convert Word documents to PDF from C# and VB.NET without Microsoft Word: DOCX, DOCM, DOTX, DOTM, DOC and DOT, RTF, WordML, plain text, and HTML and Markdown read as Word documents. The document is laid out by a Word layout engine in the library, on Windows, Linux and macOS.

The Word to PDF converter is part of ExpertPdf Anywhere, the .NET library with every ExpertPdf tool. Get the PDF as bytes, a file or a stream, with bookmarks from the headings, PDF/A or tagged PDF/UA.

NuGet · ExpertPdf.Anywhere C# & VB.NET samples
Input DOCX, DOC, RTF, text, HTML, Markdown
Output PDF bytes, file or stream
Runs on Windows, Linux and macOS

Everything Word to PDF does.

How the Word document is read and laid out, and how the PDF document comes out.

Input & layout

What goes in.

Word documents from a file, a stream or bytes, laid out without Microsoft Word.

Word formats

DOCX, DOCM, DOTX, DOTM, DOC and DOT, RTF and WordML. The format is found from the file extension or the content, or set with WordFormat.

Text, HTML and Markdown

Plain text, HTML and Markdown files are read as Word documents and converted the same way.

The document's page setup

The PDF pages take the page sizes and margins of the document, a different size for each section included. Or lay the document out again on your page size, orientation and margins.

Fields

Dates, page numbers and counts and cross-references are updated as Word updates them when it saves a PDF; UpdateFields recalculates every field.

Protected documents

Open a password protected document with Password.

Fonts

A font the host does not have is replaced by one with the same metrics. Hosts without fonts get them from the ExpertPdf.Anywhere.Fonts package.

PDF output

How the PDF comes out.

Bookmarks, form fields, standards and security, as bytes, a file or a stream.

Bookmarks

The PDF outline from the headings of the document (the default), from its bookmarks, or none.

Form fields

Keep the form fields of the document as PDF form fields with PreserveFormFields.

Page ranges

Convert only some pages, for example "1-3,5", with PageRanges.

PDF/A and PDF/UA

PDF/A and PDF/X documents, and tagged PDF/UA-1 and PDF/UA-2 documents with the headings, lists, tables and alternative text of the Word document.

Header, footer and security

A header and a footer with a title, a text and page numbers, passwords and permissions, and the document information, as in the HTML to PDF converter.

In a PDF you build

Add a Word document to a PDF document made with the PDF Creator API, as a WordToPdfElement.

A Word document, as a PDF.

Create a PdfConverter from ExpertPdf.Anywhere.WordToPdf, set the options and call one conversion method. The tabs convert a file with page numbers and bookmarks, and a stream to an accessible A4 document.

Program.cs · C#
using ExpertPdf.Anywhere.WordToPdf;

var converter = new PdfConverter();
// converter.LicenseKey = "your license key";

// Page numbers in the footer
converter.PdfDocumentOptions.ShowFooter = true;
converter.PdfFooterOptions.ShowPageNumber = true;

// The PDF bookmarks from the headings of the document
converter.Bookmarks = WordBookmarks.Headings;

converter.SavePdfFromWordFileToFile("report.docx", "report.pdf");

Install the package of your operating system, dotnet add package ExpertPdf.Anywhere.Windows (or .Linux, .Linux.Arm64, .MacOS); it brings the ExpertPdf Anywhere library with it. The Word to PDF topic describes every option, and the online sample converts your own document.

Word to PDF questions, answered.

Common questions about formats, layout, fonts and licensing.

Does it need Microsoft Word?
No. The document is laid out by a Word layout engine in the library. Nothing is installed on the server and no Office application is started, on Windows, Linux or macOS.
Which documents can it convert?
DOCX, DOCM, DOTX, DOTM, DOC and DOT documents, RTF, WordML and plain text, and HTML and Markdown read as Word documents. The format is found from the file extension or from the content; pass a WordFormat to set it.
Do the PDF pages keep the page size of the document?
Yes, by default (PageSetup = WordPageSetup.Document) the PDF pages take the page sizes and margins of the document, a different size for each section included. With WordPageSetup.Options the document is laid out again on the page size, orientation and margins of PdfDocumentOptions.
Are the fields of the document updated?
The fields Word refreshes when it saves a PDF (dates and times, page numbers and counts, cross-references) are updated, and the others keep the result stored in the document, as Word shows them. Set UpdateFields to recalculate every field.
Can it produce PDF/A or accessible PDF?
Yes. PdfStandardSubset produces PDF/A and PDF/X documents, and AccessibilityStandard tagged PDF/UA-1 or PDF/UA-2 documents, tagged from the headings, paragraphs, lists, tables and the alternative text of the pictures of the Word document. Set Language and the title for an accessible document.
What happens with a font the server does not have?
It is replaced by a font with the same metrics, so lines and pages break as in Word. On Linux and macOS hosts without fonts (containers, for example), add the ExpertPdf.Anywhere.Fonts package.
Does it run in Docker and in the cloud?
Yes. Linux containers run on the standard .NET images with nothing installed in the image, and ExpertPdf Anywhere runs on Azure, AWS and Google Cloud Run. See cloud deployments.
How is it licensed?
Word to PDF is part of ExpertPdf Anywhere, with every other ExpertPdf tool, from $700. Install it from NuGet and try every feature in evaluation mode, then license it on the pricing page.

Convert Word to PDF from .NET.

Install ExpertPdf Anywhere from NuGet and try every feature in evaluation mode. License it on the pricing page when you are ready.

Targets.NET Standard 2.0 · .NET 8 · .NET 10 · Windows · Linux · macOS
Versionv22.0.0