OptionalContentGroup: { creatorInfo?: { Creator: string; Subtype: string }; exportState?: "ON" | "OFF"; id: string; intent?: "View" | "Design"; name: string; printState?: "ON" | "OFF"; type: "OCG" | string; viewState?: "ON" | "OFF"; visible: boolean; zoom?: { max?: number; min?: number } }

Represents an Optional Content Group (OCG), also known as a "Layer" in a PDF document. OCGs allow content to be dynamically shown or hidden based on user interactions or viewing conditions. Defined in ISO 32000-2.

Type declaration

  • Optional creatorInfo?: { Creator: string; Subtype: string }

    Metadata about the application that created the optional content group. This is an optional dictionary that stores application-specific data.

    • Creator: string

      The name of the application that created the group.

    • Subtype: string

      The intended content type of the group. Suggested values include:

      • "Artwork" - for graphic design or publishing applications.
      • "Technical" - for technical drawings such as schematics or architectural plans.
  • Optional exportState?: "ON" | "OFF"

    The export state of the group. If "ON", content in this group should be included in exported output (e.g., saving, flattening). If "OFF", content in this group should be excluded from export.

  • id: string

    The unique identifier of the optional content group.

  • Optional intent?: "View" | "Design"

    Specifies the intended use of the graphics in this group. A PDF processor may selectively render content based on this intent.

    • "View": Intended for on-screen viewing (default).
    • "Design": Intended for design-related content.

    If "Design" is specified, a creatorInfo entry should also be included.

  • name: string

    The display name of the optional content group.

  • Optional printState?: "ON" | "OFF"

    The print state of the group. If "ON", the group will be printed. If "OFF", the group will be hidden in printed output.

  • type: "OCG" | string

    The type of the optional content group. "OCG" (Optional Content Group) is the standard type, but custom types may be used.

  • Optional viewState?: "ON" | "OFF"

    The initial view state of the group when the document is opened. If "ON", the group is visible by default. If "OFF", the group is hidden by default.

  • visible: boolean

    The current visibility state of the group in the viewer. This does not necessarily reflect its default state in the document.

  • Optional zoom?: { max?: number; min?: number }

    Defines a range of zoom levels at which this optional content group should be visible.

    • Optional max?: number

      The maximum zoom level beyond which the group should be hidden. Default: Infinity (always visible at any zoom level).

    • Optional min?: number

      The minimum zoom level at which the group should be visible. Default: 0 (always visible at any zoom level).