OptionalContentConfig: { creator: null | string; getGroup: any; getGroups: any; getOrder: any; isVisible: any; name: null | string; setVisibility: any; viewScale: number }

Represents an Optional Content Configuration (OCConfig) in a PDF document. This configuration defines the visibility and behavior of Optional Content Groups (OCGs).

Based on ISO 32000-2, an Optional Content Configuration manages:

  • The default state of OCGs.
  • The visibility order of layers.
  • Application-specific metadata.

Type declaration

  • creator: null | string

    The name of the application or process that created this configuration. Can be null if unspecified.

  • getGroup:function
    • Retrieves an Optional Content Group (OCG) by its unique identifier.

      Returns

      The corresponding OptionalContentGroup, or throws an error if not found.

      Parameters

      • id: string

        The ID of the content group.

      Returns OptionalContentGroup

  • getGroups:function
    • Retrieves all Optional Content Groups (OCGs) defined in the document.

      Returns

      An object where the keys are group IDs and the values are OptionalContentGroup instances.

      Returns { [id: string]: OptionalContentGroup }

  • getOrder:function
    • Retrieves the order in which Optional Content Groups should be displayed in the layers panel.

      This can be:

      • An array of string IDs representing a simple ordered list of groups.
      • An array of objects containing a name and an order, where order is a list of grouped layers.

      Returns

      The configured display order of the groups.

      Returns (string | { name: string | null; order: string[] })[]

  • isVisible:function
    • Checks whether an Optional Content Group (OCG) is currently visible.

      Returns

      true if the group is visible, otherwise false.

      Parameters

      Returns boolean

  • name: null | string

    A user-friendly name for this configuration. Can be null if unnamed.

  • setVisibility:function
    • Sets the visibility state of an Optional Content Group (OCG).

      Parameters

      • id: string

        The ID of the content group.

      • visible: boolean

        true to make the group visible, false to hide it.

      Returns void

  • viewScale: number

    Defines the scaling factor applied when viewing optional content. This is used to determine the effective visibility of OCGs based on zoom levels.