pdfLoadLayerConfig
Apply an alternate configuration's layer visibility to the
| Category | Optional content |
|---|
Purpose — Apply an alternate configuration's layer visibility to the document's *current* (working) OCG visibility state.
Description — Index=0 restores every OCG to the visibility it had when created via pdfCreateOCG (the default /D config). Index >= 1 applies a named config created via pdfCreateOCLayerConfig — note the off-by-one: Index here is a config-*index* (Index-1 is the 0-based slot into the config array), whereas pdfCreateOCLayerConfig returns a 1-based config-*handle*. In practice they are numerically the same value for a config created immediately after CreateOCLayerConfig returns N: pass N as Index to load it. For that config, every OCG first takes the config's /BaseState, then explicit per-OCG ON overrides are applied, then explicit OFF overrides (pdfSetOCGConfigState) — OFF wins if an OCG is marked in both arrays for the same config (should not normally occur, since SetOCGConfigStateH always writes both arrays consistently as mutually exclusive).
Declarations
BOOL32 __stdcall pdfLoadLayerConfig(PPDF IPDF, int32_t Index);
function pdfLoadLayerConfig(const IPDF: PPDF; Index: Integer): LongBool; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Index | Integer | 0 = default config; 1..configCount = a named config. |
Return value — TRUE on success; FALSE if there are no OCGs, or Index is out of range for a named config.
See also — pdfCreateOCLayerConfig, pdfGetLayerConfig
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Core
pdfLoadLayerConfig
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.