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 an HTML Document to PDF format

The following code sample shows how to export an HTML document to PDF format using the RichEditDocumentServer.ExportToPdf method.

server.LoadDocument("Documents\\TextWithImages.htm");
server.ExportToPdf("Document_PDF.pdf");
System.Diagnostics.Process.Start("Document_PDF.pdf");

Pass the PdfExportOptions instance to the RichEditDocumentServer.ExportToPdf method to specify the exporting options (image quality, additional metadata, etc.).

Note

Implement the IUriProvider descendant and override the IUriProvider.CreateCssUri or IUriProvider.CreateImageUri method to manage decoding external contents in an HTML file. It executes your method instead of the default one when the RichEditDocumentServer needs to load data from a specific URI. Refer to the How to: Retain the Image URI in HTML Document topic for details.