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

Settings

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

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

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

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

  • 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.

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

[C#] 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.

[C#] 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.

[C#] 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