Skip to main content
All docs
V24.1

PdfOptionalContentGroupVisibilityCollection Class

A collection of PdfOptionalContentGroupVisibility objects.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.1.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public class PdfOptionalContentGroupVisibilityCollection :
    IReadOnlyList<PdfOptionalContentGroupVisibility>,
    IReadOnlyCollection<PdfOptionalContentGroupVisibility>,
    IEnumerable<PdfOptionalContentGroupVisibility>,
    IEnumerable

The following members return PdfOptionalContentGroupVisibilityCollection objects:

Remarks

The PdfOptionalContentGroupVisibility class contains visibility settings that correspond to a layer (the PdfOptionalContentGroup object). All PdfOptionalContentGroupVisibility objects are stored in a PdfOptionalContentGroupVisibilityCollection object and can be accessed with the PdfDocumentFacade.OptionalContentVisibility.Groups property by index.

The following code snippet hides two layers in the “PdfLayers.pdf” document and displays the third layer:

Layers Visibility

using DevExpress.Pdf;
using System;
using System.Linq;
using DevExpress.Drawing;

static void Main(string[] args) {
    using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
        processor.LoadDocument("PdfLayers.pdf");
        // Set visibility settings for each layer contained in a document.
        processor.DocumentFacade.OptionalContentVisibility.Groups[0].Visible = false;
        processor.DocumentFacade.OptionalContentVisibility.Groups[1].Visible = false;
        processor.DocumentFacade.OptionalContentVisibility.Groups[2].Visible = true;
        // Print the document.
        DXBitmap bitmap = processor.CreateDXBitmap(1, 1000);
        PdfPrinterSettings pdfPrinterSettings = new PdfPrinterSettings();
        processor.Print(pdfPrinterSettings);
    }
}

Refer to the following topic for more information on how to control layer visibility: Manage Visibility of Layers (Optional Content Groups).

Inheritance

Object
PdfOptionalContentGroupVisibilityCollection
See Also