Using PdfFormatProvider

PdfFormatProvider makes it easy to export RadDocument to PDF format, preserving the entire document structure and formatting.

All you have to do in order to use PdfFormatProvider is add references to the assemblies listed below:

  • Telerik.Windows.Documents.FormatProviders.Pdf.dll
  • Telerik.Windows.Zip.dll

Export

In order to export a document to PDF you need to use the Export() method of PdfFormatProvider.

The code snippet in Example 1 shows how to create a PdfFormatProvider instance and use it to export the document to PDF.

The PdfFormatProvider class of RadRichTextBox is located in the Telerik.Windows.Documents.FormatProviders.Pdf namespace.

Example 1: Export to PDF file

PdfFormatProvider provider = new PdfFormatProvider(); 
using (Stream output = File.OpenWrite("sample.pdf")) 
{ 
    RadDocument document = CreateRadDocument(); 
    provider.Export(document, output); 
} 
The result from the method is a document that can be opened in any application that supports PDF documents.

See Also

In this article