officefileapi-devexpress-dot-pdf-dot-pdfoptionalcontentvisibility.md
Provides access to objects stored in the PdfOptionalContentGroupVisibilityCollection.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfOptionalContentGroupVisibilityCollection Groups { get; }
Public ReadOnly Property Groups As PdfOptionalContentGroupVisibilityCollection
| Type | Description |
|---|---|
| PdfOptionalContentGroupVisibilityCollection |
A collection of PdfOptionalContentGroupVisibility objects.
|
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:
using DevExpress.Pdf;
using System;
using System.Linq;
using DevExpress.Drawing;
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);
}
Imports DevExpress.Pdf
Imports System
Imports System.Linq
Imports DevExpress.Drawing
Using processor As 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.
Dim bitmap As DXBitmap = processor.CreateDXBitmap(1, 1000)
Dim pdfPrinterSettings As New PdfPrinterSettings()
processor.Print(pdfPrinterSettings)
End Using
See Also
PdfOptionalContentVisibility Class