corelibraries-devexpress-dot-xtraprinting-da31bad1.md
Contains options that define how a document is exported to PDF format.
Namespace : DevExpress.XtraPrinting
Assembly : DevExpress.Printing.v25.2.Core.dll
NuGet Package : DevExpress.Printing.Core
public class PdfExportOptions :
PageByPageExportOptionsBase
Public Class PdfExportOptions
Inherits PageByPageExportOptionsBase
The following members return PdfExportOptions objects:
| Library | Related API Members |
|---|---|
| Cross-Platform Class Library | ExportOptions.Pdf |
| WinForms Controls | DiagramOptionsExport.PdfExportOptions |
| WPF Controls | DiagramControl.PdfExportOptions |
Review the following help topic for more information about specifics of exporting a document to PDF for the DevExpress WinForms controls: Export to PDF.
Refer to the following help topic for the detail description of the PDF export options available for the DevExpress Reporting: Export to PDF.
This example illustrates how to export a report to PDF using the XtraReport.ExportToPdf method with specific PdfExportOptions applied.
View Example: How to Export a Report to PDF and Specify Export Options
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);
}
}
}
}
Imports DevExpress.XtraPrinting
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
' ...
Namespace WindowsFormsApplication1
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
' A path to export a report.
Dim reportPath As String = "c:\\Temp\Test.pdf"
Using report As New XtraReport1()
' Specify PDF-specific export options.
Dim pdfOptions As PdfExportOptions = 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.
Dim result As IList(Of String) = pdfOptions.Validate()
If result.Count > 0 Then
Console.WriteLine(String.Join(Environment.NewLine, result))
Else
report.ExportToPdf(reportPath, pdfOptions)
End If
End Using
End Sub
End Class
End Namespace
Object ExportOptionsBase PageByPageExportOptionsBase PdfExportOptions
See Also