PdfFormatProvider is part of SpreadProcessing which allows export to PDF format.
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.
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 knowledge base article.
In order to use PdfFormatProvider you need to add references to the assemblies listed below:
The .NET Standard specification does not define APIs for getting specific fonts. PdfFormatProvider needs to have access to the font data so that it can read it and add it to the PDF file. That is why, to allow the library to create and use fonts, you will need to 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 article.
.NET Standard: In order to export images different than Jpeg and Jpeg2000 or ImageQuality different than High, the JpegImageConverter property inside the FixedExtensibilityManager has to be set. For more information check the FixedExtensibilityManager in the PdfProcessing`s Cross-Platform Support
Example 1 shows how to use PdfFormatProvider to export a Workbook to a file.
Example 1: PdfFormatProvider export example
Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider pdfFormatProvider = new Telerik.Windows.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.
The result from the export method is a document that can be opened in any application that supports PDF documents.
Example 2: Export to RadFixedDocument
Workbook workbook = CreateSampleWorkbook();
Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.PdfFormatProvider provider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.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.