The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

How To: Convert a DOCX Document to PDF format

This example demonstrates how to export a document to PDF format using the RichEditDocumentServer.ExportToPdf method.

To set the export options, an PdfExportOptions instance can be used. It provides a number of properties, such as PdfExportOptions.ImageQuality and PdfExportOptions.ConvertImagesToJpeg, allowing you to adjust the required settings for export.

server.LoadDocument("Documents\\MovieRentals.docx", DocumentFormat.OpenXml);
//Specify export options:
PdfExportOptions options = new PdfExportOptions();
options.DocumentOptions.Author = "Mark Jones";
options.Compressed = false;
options.ImageQuality = PdfJpegImageQuality.Highest;
//Export the document to the stream: 
using (FileStream pdfFileStream = new FileStream("Document_PDF.pdf", FileMode.Create))
{
    server.ExportToPdf(pdfFileStream, options);
}
System.Diagnostics.Process.Start("Document_PDF.pdf");