# Using PdfFormatProvider

`PdfFormatProvider` is part of SpreadProcessing and allows export to PDF format.

## Using PdfFormatProvider

`PdfFormatProvider` makes it easy to export a Workbook to PDF format. Each Worksheet exported to PDF is divided into pages according to its `WorksheetPageSetup`. For more information about paging a Worksheet, see the [Worksheet Page Setup](https://www.telerik.com/document-processing-libraries/documentation/libraries/radspreadprocessing/features/worksheetpagesetup) article.

> note For more examples and application scenarios of importing and exporting a Workbook to various formats using a FormatProvider, check out the [Import/Load and Export/Save RadSpreadProcessing Workbook](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/import-export-save-load-workbook) knowledge base article.

## Prerequisites

To use `PdfFormatProvider`, add references to the following packages:

* **.NET Framework**, **.NET 8, .NET 9 and .NET 10** (or later) for Windows
  * Telerik.Windows.Documents.Spreadsheet
  * Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf

* **.NET Standard 2.0 (.NET 8, .NET 9 and .NET 10)**
  * Telerik.Documents.Spreadsheet
  * Telerik.Documents.Spreadsheet.FormatProviders.Pdf

## Export

> note The **.NET Standard** specification does not define APIs for getting specific fonts. `PdfFormatProvider` needs access to the font data so that it can read it and add it to the PDF file. To allow the library to create and use fonts, you must provide an implementation of the `FontsProviderBase` abstract class and set this implementation to the `FontsProvider` property of `FixedExtensibilityManager`. For detailed information, check the [Cross-Platform Support](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/cross-platform/overview) article.

> note **.NET Standard**: To export images different than **Jpeg** and **Jpeg2000** or **ImageQuality** different than High, set the `JpegImageConverter` property inside the `FixedExtensibilityManager`. For more information, check the [PdfProcessing Cross-Platform Support](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/cross-platform/overview) article.

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

**Example 1: Export a workbook to a PDF file stream**

```C#
Telerik.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider pdfFormatProvider = new Telerik.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider();
using (Stream output = File.OpenWrite("Sample.pdf"))
{
    Workbook workbook = CreateSampleWorkbook(); // The CreateSampleWorkbook() method generates a sample spreadsheet document. Use your Workbook object here.

    pdfFormatProvider.Export(workbook, output, TimeSpan.FromSeconds(10));
}
```

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

**Example 2: Export a workbook directly to a RadFixedDocument instance**

```C#
Workbook workbook = CreateSampleWorkbook();

Telerik.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider provider = new Telerik.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider();

RadFixedDocument fixedDocument = provider.ExportToFixedDocument(workbook, TimeSpan.FromSeconds(10));
```

> tip `RadFixedDocument` is the base class of the `RadPdfProcessing` library. For more information about the library and its features, see the [RadPdfProcessing Overview](https://www.telerik.com/document-processing-libraries/documentation/libraries/radpdfprocessing/overview).

## See Also

* [How to Eliminate Formatting Issues when Exporting XLSX to PDF Format](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/exporting-xlsx-to-pdf-formatting-issues)
* [Import/Load and Export/Save RadSpreadProcessing Workbook](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/import-export-save-load-workbook)
* [Export Worksheet to Image](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/spreadprocessing-export-worksheet-to-image-netstandard)
* [Preserving the Font in PDF Export from Excel](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/preserve-font-boldness-pdf-export-radspreadprocessing)
* [Timeout Mechanism](https://www.telerik.com/document-processing-libraries/documentation/knowledge-base/timeout-mechanism-in-dpl)
