[]
type OptionalContentConfig = object;
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:
creator: null | string;
The name of the application or process that created this configuration.
Can be null
if unspecified.
name: null | string;
A user-friendly name for this configuration.
Can be null
if unnamed.
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.
getGroup(id): OptionalContentGroup;
Retrieves an Optional Content Group (OCG) by its unique identifier.
string
The ID of the content group.
The corresponding OptionalContentGroup
, or throws an error if not found.
getGroups(): object;
Retrieves all Optional Content Groups (OCGs) defined in the document.
object
An object where the keys are group IDs and the values are OptionalContentGroup
instances.
getOrder(): (
| string
| {
name: string | null;
order: string[];
})[];
Retrieves the order in which Optional Content Groups should be displayed in the layers panel.
This can be:
name
and an order
, where order
is a list of grouped layers.(
| string
| {
name
: string
| null
;
order
: string
[];
})[]
The configured display order of the groups.
isVisible(groupOrId): boolean;
Checks whether an Optional Content Group (OCG) is currently visible.
The group instance or its ID.
string
| OptionalContentGroup
boolean
true
if the group is visible, otherwise false
.
setVisibility(id, visible): void;
Sets the visibility state of an Optional Content Group (OCG).
string
The ID of the content group.
boolean
true
to make the group visible, false
to hide it.
void