Skip to main content

ExportOptions.SetOptionsVisibility(ExportOptionKind[], Boolean) Method

Changes the visibility of the specified export options in the Print Preview.

Namespace: DevExpress.XtraPrinting

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

NuGet Package: DevExpress.Printing.Core

Declaration

public void SetOptionsVisibility(
    ExportOptionKind[] optionKinds,
    bool visible
)

Parameters

Name Type Description
optionKinds ExportOptionKind[]

An array of ExportOptionKind enumeration values specifying the export options whose visibility needs to be changed.

visible Boolean

true to make the export options visible; otherwise, false.

Remarks

Use the SetOptionsVisibility method to change the visibility of the array of export options simultaneously. To change the visibility of a single export option only, use the ExportOptions.SetOptionVisibility method.

Note

To get the current visibility state of an export option, the ExportOptions.GetOptionVisibility method should be used.

Example

This example illustrates how to hide some of the export options from a print preview by using the ExportOptions.SetOptionVisibility and ExportOptions.SetOptionsVisibility methods.

The following code hides some of the PDF-specific export options.

All available export options are listed in the ExportOptionKind enumeration.

using System.Drawing;
using DevExpress.XtraPrinting;
// ...

private void Form1_Load(object sender, EventArgs e) {
    PrintingSystem ps = new PrintingSystem();
    documentViewer1.PrintingSystem = ps;

    // Draw a simple text brick.
    ps.Begin();
    ps.Graph.DrawString("Some Text", new RectangleF(0, 20, 200, 20));
    ps.End();

    // Obtain its Export options.
    ExportOptions options = ps.ExportOptions;

    // Hide the "Never Embedded Fonts" option, if required.
    if(options.GetOptionVisibility(ExportOptionKind.PdfNeverEmbeddedFonts) != false) {
        options.SetOptionVisibility(ExportOptionKind.PdfNeverEmbeddedFonts, false);
    }

    // Hide all Document Options for PDF export.
    options.SetOptionsVisibility(new ExportOptionKind[] { ExportOptionKind.PdfDocumentApplication,
        ExportOptionKind.PdfDocumentAuthor, ExportOptionKind.PdfDocumentKeywords,
        ExportOptionKind.PdfDocumentSubject, ExportOptionKind.PdfDocumentTitle}, false);            
}
See Also