Skip to main content
A newer version of this page is available. .

Export to PDF

  • 9 minutes to read

Export From Preview (Visual Studio, WinForms, WPF)

You can export a report from Visual Studio Preview tab, WinForms Print Preview, and WPF Print Preview. Expand the drop-down list with export formats and select PDF File.

Specify export options in the invoked PDF Export Options dialog and click OK.

Export From Document Viewer (Web Platforms)

You can export a report from ASP.NET Web Forms Document Viewer, ASP.NET MVC Document Viewer, and ASP.NET Core Document Viewer. Specify export options in the Export Options dialog, expand the Export To drop-down list in the toolbar, and select PDF.

Export in Code

Use the XtraReport.ExportToPdf or XtraReport.ExportToPdfAsync methods to export a report to PDF format. Specify the path/stream to which the report should be exported as the first argument in these methods. If you specify only the path/stream, the report is exported to PDF format with the default options. To change the default options, do the following:

To export a large report in code, use the PdfStreamingExporter class instead of the XtraReport.ExportToPdf/XtraReport.ExportToPdfAsync method calls. You can use the PdfStreamingExporter class together with CachedReportSource (WinForms/WPF) or CachedReportSourceWeb (Web platforms).


View Example: Export a Report to PDF Format

using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using System.Windows.Forms;
using System;

namespace PdfExportExample {
    public partial class Form1 : Form {
        public Form1() {

        private void Form1_Load(object sender, EventArgs e) {
            // Create a report.
            XtraReport report = new XtraReport() {
                Name = "Report Example",
                Bands = {
                    new DetailBand() {
                        Controls = {
                            new XRLabel() {
                                Text = "Some content goes here...",

            // Specify export options.
            PdfExportOptions pdfExportOptions = new PdfExportOptions() {
                PdfACompatibility = PdfACompatibility.PdfA1b

            // Specify the path for the exported PDF file.  
            string pdfExportFile =
                Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) +
                @"\Downloads\" +
                report.Name +

            // Export the report.
            report.ExportToPdf(pdfExportFile, pdfExportOptions);

PDF Document Versions

The PDF export engine produces the following PDF document versions:

PDF 1.4 (default)
Supported in Adobe Acrobat version 5.0 or later.
PDF 1.6
Adobe Acrobat 7.0 or later. Used if you enable Password Security and set Encryption Level to AES128 or ARC4.
PDF 1.7
Adobe Acrobat 9.0 or later. Used if you enable Password Security and set Encryption Level to AES256.

Export Options

The following options are available in the PDF Export Dialog invoked from Visual Studio Preview tab, WinForms Print Preview, and WPF Print Preview, and in the Export Options dialog of the Document Viewer (Web platforms).

The options below are available only in the Properies panel of the Report Designer (Visual Studio, WinForms, and WPF) …

… and in the Export options dialog of the Document Viewer (Web platforms).

Page Range

The Page Range option specifies the range of pages that should be exported to a PDF file. For example, the “1,3,5-12” range exports the first, third, and all pages from the fifth to 12th.

Export Editing Fields to AcroForms

Enable the Export Editing Fields To AcroForms option to convert a report’s editing fields to interactive forms in the exported PDF file.

PDF/A Compatibility

Use the Pdf/A Compatibility option to make the exported PDF file compatible with the PDF/A specification. Set the option to one of the following values:

  • PDF/A-1b (ISO 19005-1)
  • PDF/A-2b (ISO 19005-2:2011)
  • PDF/A-3b (ISO 19005-3:2012)

When the option is set to the default value (None), the exported PDF file conforms to ISO 32000-1:2005.

When you create a PDF/A compatible document, you can add additional metadata to the exported PDF file. Refer to the code example below that exports a simple report to a PDF/A-3b (ISO 19005-3) file. The exported file meets the ZUGFeRD specification used for electronic invoices in Germany.

View Example

The following PDF export options are not supported for PDF/A compatible documents:

If you export a report to a PDF/A compatible document in code, use the Validate method to check whether the specified export options can be used for PDF/A compatible documents.

File Size Optimization

Use the options below to decrease the size of the exported PDF file.

Image Quality

Enable the Convert Images To JPEG option to convert all images to JPEG. An image is converted to JPEG if the size of a JPEG image is smaller than the original image size. When the option is enabled, you can use the Image Quality option to change the image quality and the Rasterization Resolution option to specify the image resolution.

Never Embedded Fonts

Use the Do Not Embed These Fonts (Never Embedded Fonts in the Document Viewer) to specify fonts that should not be embedded to the exported PDF file.

Password Security

Use the Password Security options to specify an open password and permissions to copy, print, and use screen readers for the exported PDF file. To encrypt the content of the PDF file, set encryption level to one of the following algorithms:

  • 128-bit AES (Advanced Encryption Standard) - the default algorithm;
  • 256-bit AES (Advanced Encryption Standard);
  • 128-bit ARC4 (Alleged Rivest Cipher 4).


PDF passwords are stored in report definitions as plain text. Ensure that only trusted parties have access to report definition files.

Digital Signature

You can sign a report with an X.509 certificate when you export it to PDF. The specified signature information is saved to the document’s PDF Signature Options.

Run Demo: Online Run Demo: Desktop

Add Document Signature

The XRPdfSignature control can visualize the document’s signature in the exported PDF file.

Document Options

Use Document Options to specify information that should be embedded as Document Properties in the exported PDF file.

Show Print Dialog On Open

Enable the Show Print Dialog On Open option to invoke a print dialog when users open the exported PDF file. Do not use this option in web applications because most modern browsers disable scripts in PDF.


  • EMF and WMF images cannot be exported. Only EMF+ is available.
  • The PDF/A-1b standard does not support transparent images. In PDF/A-1b compatible files, an alpha channel in images is ignored.
  • Universal accessibility is not supported. Exported PDF files do not conform to the PDF/A-1a, PDF/A-2a, PDF/A-3a, and PDFA-4 standards.
  • The background of the exported PDF file is filled with the color assigned to the PageColor property. Set this property to Transparent if you add a background image to the exported PDF file.
  • In Adobe Reader, hyperlinks for the exported PDF file work only if the Create links from URLs option is enabled.


The Exported PDF File Differs From the Print Preview: Troubleshooting

A reporting application uses the Windows GDI+ API to draw the Print Preview. The PDF export engine utilizes another API to generate a PDF file from a report. Since the two APIs use different algorithms to process characters, the exported PDF file might differ from the report’s Print Preview.

Missed Characters in the Exported PDF File

The GDI+ API implements font fallback while the PDF export engine does not. If a font you use in a report does not contain a glyph for a character, the GDI+ API uses a glyph from another font to display the character in the Print Preview. In the exported PDF file, this character is not displayed.

To address this problem, do the following:

  • Use a font that contains glyphs for all characters you use in a report. Use the Windows Character Map Tool or FontForge to check whether a font contains glyphs for characters from a Unicode range.


    Ensure that fonts you use in a report are installed on the machine where the report is exported to PDF.

  • If you use XRLabel or table cells to display data, substitute these labels/cells with XRRichText.


    If you use this method, memory consumption can increase and the resulting report appearance might differ from its initial appearance.

Inconsistent Line Breaks

The GDI+ API and the reporting PDF export engine use different algorithms to process line breaks. If you use Chinese, Japanese, or Korean characters in a report, line breaks might be displayed differently in the Print Preview and exported PDF file.

To resolve this issue, set the UseGdiPlusLineBreakAlgorithm property to true to use the GDI+ line break algorithm when a report is exported to PDF.