Edit this page
Available for: UI for ASP.NET AJAX | UI for ASP.NET MVC | UI for WPF | UI for WinForms | UI for Silverlight

Using PdfFormatProvider

PdfFormatProvider is part of SpreadProcessing which allows export to PDF format.

Using PdfFormatProvider

PdfFormatProvider makes it easy to export a Workbook to a PDF format. Each Worksheet exported to PDF is being divided into pages according to its WorksheetPageSetup. More information about paging a Worksheet is available in the Worksheet Page Setup documentation article.

Prerequisites

In order to use PdfFormatProvider you need to add references to the assemblies listed below:

  • Telerik.Windows.Documents.Spreadsheet.dll

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

Export

Example 1 shows how to use PdfFormatProvider to export a Workbook to a file.

[C#] Example 1: PdfFormatProvider export example

PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
using (Stream output = GetFileStream())
{
    Workbook workbook = CreateSampleWorkbook();
    pdfFormatProvider.Export(workbook, output);
}

The result from the export method is a document that can be opened in any application that supports PDF documents.

[C#] Example 2: Export to RadFixedDocument

Workbook workbook = CreateSampleWorkbook();

PdfFormatProvider provider = new PdfFormatProvider();
RadFixedDocument fixedDocument = provider.ExportToFixedDocument(workbook);

RadFixedDocument is the base class of the RadPdfProcessing library. Additional information on the library and its functionality can be found here.