Available for: UI for ASP.NET MVC | UI for ASP.NET AJAX | UI for Blazor | UI for WPF | UI for WinForms | UI for Silverlight | UI for Xamarin | UI for WinUI | UI for ASP.NET Core | UI for .NET MAUI

New to Telerik Document Processing? Download free 30-day trial

Settings

PdfFormatProvider allows to export PDF documents. Additionally, there are a number of settings that allow you to modify the export. The current article outlines the available settings.

PdfExportSettings allow controlling how a Workbook is exported to PDF. Using PdfExportSettings you may specify:

  • ExportWhat: Enumeration specifying whether to export the Active Sheet, the Entire Workbook or the current Selection.

  • IgnorePrintArea: Boolean value indicating whether or not to ignore print area when exporting worksheets.

  • IncludeHiddenSheets: Bolean value indicating whether to include the hidden sheets or to skip them. Default value is false.

  • SelectedRanges property: A list of ranges specifying which areas of the active worksheet should be exported. Using the ExportWhat.Selection option you may specify that you need to export exactly this SelectedRanges from the current worksheet, ignoring PrintArea and PageBreaks from WorksheetPageSetup.

  • PdfFileSettings: A property of type Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExportSettings which is a class related to the RadPdfProcessing library. Thus, the property allows you to control the image quality, encryption, compliance level and other PDF format related properties. More information on the settings is available in the export settings article for RadPdfProcessing.

  • ChartRenderer: A property of type IPdfChartRenderer that gets or sets the renderer which will be used to render charts. It is not relevant for the .NET Standard version of the Telerik Document Processing libraries. Read more in the Export Chart to PDF article.

Example 1 shows how to export the Entire Workbook without ignoring the PrintArea property in all worksheets.

Example 1: Export entire workbook

PdfFormatProvider provider = new PdfFormatProvider(); 
provider.ExportSettings = new PdfExportSettings(ExportWhat.EntireWorkbook, false); 

Example 2 shows how to export only two selected ranges from the active worksheet, ignoring print areas and page breaks.

Example 2: Export selection

CellRange[] rangesToExport = new CellRange[] 
{ 
    new CellRange(2, 3, 10, 15), 
    new CellRange(4, 5, 8, 20) 
}; 
 
PdfFormatProvider provider = new PdfFormatProvider(); 
provider.ExportSettings = new PdfExportSettings(rangesToExport); 

In order to specify file export settings to the PdfFormatProvider you need to add both the Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export and Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export namespaces. In Example 3 the Fixed alias corresponds to the Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export namespace.

Another export option is to specify settings specific to the PDF format to the exported document. Example 3 demonstrates how to utilize the PdfFileSettings property in order to export a PDF/A-compliant document.

Example 3: Export PDF/A compliant document

PdfFormatProvider provider = new PdfFormatProvider(); 
 
Fixed.PdfExportSettings fileSettings = new Fixed.PdfExportSettings(); 
fileSettings.ComplianceLevel = Fixed.PdfComplianceLevel.PdfA2B; 
 
provider.ExportSettings.PdfFileSettings = fileSettings; 

See Also

In this article