PdfExportOptions.Validate() Method

Checks the validity of PDF export options and returns a list of any detected inconsistencies.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v20.1.Core.dll

Declaration

public IList<string> Validate()
Public Function Validate As IList(Of String)

Returns

Type Description
IList<String>

A collection of String values, specifying inconsistencies detected in the PDF export options.

Examples

The following code illustrates how to use the PdfExportOptions.Validate method to check the validity of PDF export options.

Use this method to make sure that none of the specified options are mutually exclusive, e.g., when applying PDF/A options to a document (PdfExportOptions.PdfACompatibility).

In this example, the following inconsistencies will be detected.

  • "PDF/A standard implicitly forbids showing the print dialog on opening a document."
  • "Encryption is not supported in a PDF/A document."
using DevExpress.XtraPrinting;
using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
// ...

using (XtraReport report = new XtraReport()) {
    PdfExportOptions options = new PdfExportOptions();
    options.PdfACompatibility = PdfACompatibility.PdfA1b;
    options.PasswordSecurityOptions.PermissionsPassword = "pwd";
    options.ShowPrintDialogOnOpen = true;
    IList<string> result = options.Validate();
    if (result.Count > 0)
        Console.WriteLine(String.Join(Environment.NewLine, result));
    else
        report.ExportToPdf("Result.pdf", options);
}
See Also