VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Pdf.Tree 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 Class
    Syntax
    'Declaration
     
    Public Class PdfOptionalContentGroup 
       Inherits PdfMarkedContentProperty
    public class PdfOptionalContentGroup : PdfMarkedContentProperty 
    public __gc class PdfOptionalContentGroup : public PdfMarkedContentProperty 
    public ref class PdfOptionalContentGroup : public PdfMarkedContentProperty 
    Remarks
    Optional content group (layer) is a collection of graphics that can be made visible or invisible dynamically.
    Example
    This example 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.PdfOptionalContentGroup) = document.OptionalContentProperties.OptionalContentGroups
                
            ' for each optional content group
            For Each group As Vintasoft.Imaging.Pdf.Tree.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.PdfOptionalContentGroup> allGroups = 
                document.OptionalContentProperties.OptionalContentGroups;
                
            // for each optional content group
            foreach (Vintasoft.Imaging.Pdf.Tree.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.PdfOptionalContentGroup

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also