VintaSoft Imaging .NET SDK v9.1 for .NET (.NET Core and .NET Framework)
Vintasoft.Imaging.Pdf.Tree.OptionalContent Namespace / PdfOptionalContentGroup Class
Members Example



In This Topic
    PdfOptionalContentGroup Class
    In This Topic
    Provides information about an optional content group (layer) of PDF document.
    Object Model
    PdfOptionalContentGroup ClassPdfBasicObject ClassPdfDocument ClassPdfIndirectReference ClassPdfOptionalContentUsage Class
    Syntax
    'Declaration
     
    Public Class PdfOptionalContentGroup 
       Inherits Vintasoft.Imaging.Pdf.Tree.PdfMarkedContentProperty
    public class PdfOptionalContentGroup : Vintasoft.Imaging.Pdf.Tree.PdfMarkedContentProperty 
    public __gc class PdfOptionalContentGroup : public Vintasoft.Imaging.Pdf.Tree.PdfMarkedContentProperty 
    public ref class PdfOptionalContentGroup : public Vintasoft.Imaging.Pdf.Tree.PdfMarkedContentProperty 
    Remarks
    Optional content group (layer) is a collection of graphics that can be made visible or invisible dynamically.
    Example
    Here is an example that shows how to render the PDF pages with the optional content groups:
    ''' <summary>
    ''' Renders PDF page with the optional content group.
    ''' </summary>
    ''' <param name="page">The page of PDF document.</param>
    Public Shared Function RenderPdfPageWithOptionalContentGroup(page As Vintasoft.Imaging.Pdf.Tree.PdfPage) As Vintasoft.Imaging.VintasoftImage
    	' get PDF document of page
    	Dim document As Vintasoft.Imaging.Pdf.PdfDocument = page.Document
                
    	' if document has optional content groups then
    	If document.OptionalContentProperties IsNot Nothing AndAlso document.OptionalContentProperties.OptionalContentGroups IsNot Nothing Then
    		' get a list of optional content groups of PDF document
    		Dim allGroups As System.Collections.Generic.IList(Of Vintasoft.Imaging.Pdf.Tree.OptionalContent.PdfOptionalContentGroup) = document.OptionalContentProperties.OptionalContentGroups
                
    		' for each optional content group
    		For Each group As Vintasoft.Imaging.Pdf.Tree.OptionalContent.PdfOptionalContentGroup In allGroups
    			' set the optional content group as invisible
    			document.OptionalContentConfiguration.SetGroupVisibility(group, False)
    		Next
    	End If
                
    	' render PDF page
    	Dim image As Vintasoft.Imaging.VintasoftImage = page.Render()
                
    	' return the image of PDF page
    	Return image
    End Function
    /// <summary>
    /// Renders PDF page with the optional content group.
    /// </summary>
    /// <param name="page">The page of PDF document.</param>
    public static Vintasoft.Imaging.VintasoftImage RenderPdfPageWithOptionalContentGroup(
        Vintasoft.Imaging.Pdf.Tree.PdfPage page)
    {
        // get PDF document of page
        Vintasoft.Imaging.Pdf.PdfDocument document = page.Document;
                
        // if document has optional content groups then
        if (document.OptionalContentProperties != null &&
            document.OptionalContentProperties.OptionalContentGroups != null)
        {
            // get a list of optional content groups of PDF document
            System.Collections.Generic.IList<Vintasoft.Imaging.Pdf.Tree.OptionalContent.PdfOptionalContentGroup> allGroups =
                document.OptionalContentProperties.OptionalContentGroups;
                
            // for each optional content group
            foreach (Vintasoft.Imaging.Pdf.Tree.OptionalContent.PdfOptionalContentGroup group in allGroups)
                // set the optional content group as invisible
                document.OptionalContentConfiguration.SetGroupVisibility(group, false);
        }
                
        // render PDF page
        Vintasoft.Imaging.VintasoftImage image = page.Render();
                
        // return the image of PDF page
        return image;
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Pdf.Tree.PdfTreeNodeBase
          Vintasoft.Imaging.Pdf.Tree.PdfMarkedContentProperty
             Vintasoft.Imaging.Pdf.Tree.OptionalContent.PdfOptionalContentGroup

    Requirements

    Target Platforms: .NET Core 3; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also