PdfExportOptions Class

Contains options that define how a document is exported to PDF format.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v21.2.Core.dll

Declaration

public class PdfExportOptions :
    PageByPageExportOptionsBase

The following members accept/return PdfExportOptions objects:

Library Related API Members
Cross-Platform Class Library ExportOptions.Pdf
WinForms Controls DiagramOptionsExport.PdfExportOptions
WPF Controls DiagramControl.PdfExportOptions

Remarks

To learn more, see the Export to PDF topic.

Example

This example illustrates how to export a report to PDF using the XtraReport.ExportToPdf method with specific PdfExportOptions applied.

using DevExpress.XtraPrinting;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
// ...

namespace WindowsFormsApplication1 {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e) {
            // A path to export a report.
            string reportPath = @"c:\\Temp\Test.pdf";

            using (XtraReport1 report = new XtraReport1()) {
                // Specify PDF-specific export options.
                PdfExportOptions pdfOptions = report.ExportOptions.Pdf;

                // Specify the pages to be exported.
                pdfOptions.PageRange = "1, 3-5";

                // Specify the quality of exported images.
                pdfOptions.ConvertImagesToJpeg = false;
                pdfOptions.ImageQuality = PdfJpegImageQuality.Medium;

                // Specify the PDF/A-compatibility.
                pdfOptions.PdfACompatibility = PdfACompatibility.PdfA3b;

                // The following options are not compatible with PDF/A.
                // The use of these options will result in errors on PDF validation.
                //pdfOptions.NeverEmbeddedFonts = "Tahoma;Courier New";
                //pdfOptions.ShowPrintDialogOnOpen = true;

                // If required, you can specify the security and signature options. 
                //pdfOptions.PasswordSecurityOptions
                //pdfOptions.SignatureOptions

                // If required, specify necessary metadata and attachments
                // (e.g., to produce a ZUGFeRD-compatible PDF).
                //pdfOptions.AdditionalMetadata
                //pdfOptions.Attachments

                // Specify the document options.
                pdfOptions.DocumentOptions.Application = "Test Application";
                pdfOptions.DocumentOptions.Author = "DX Documentation Team";
                pdfOptions.DocumentOptions.Keywords = "DevExpress, Reporting, PDF";
                pdfOptions.DocumentOptions.Producer = Environment.UserName.ToString();
                pdfOptions.DocumentOptions.Subject = "Document Subject";
                pdfOptions.DocumentOptions.Title = "Document Title";

                // Checks the validity of PDF export options 
                // and return a list of any detected inconsistencies.
                IList<string> result = pdfOptions.Validate();
                if (result.Count > 0)
                    Console.WriteLine(String.Join(Environment.NewLine, result));
                else
                    report.ExportToPdf(reportPath, pdfOptions);
            }

        }

    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the PdfExportOptions class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also