Skip to main content

PdfExportOptions.Validate() Method

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

Namespace: DevExpress.XtraPrinting

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

NuGet Package: DevExpress.Printing.Core

Declaration

public IList<string> Validate()

Returns

Type Description
IList<String>

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

Example

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);
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Validate() method.

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