BOOL32 __stdcall pdfSetOCGState(PPDF IPDF, uint32_t Handle, BOOL32 Visible, BOOL32 SaveState);
function pdfSetOCGState(const IPDF: PPDF; Handle: Cardinal; Visible, SaveState: LongBool): LongBool; stdcall;
Purpose. Set an OCG's default visibility in the document's base (default) configuration.
Description. Requires Handle to resolve to an existing OCG (1-based, bounds-checked); on success, sets FOCGVisible[Handle-1] := Visible. The SaveState parameter is accepted by the ABI but never read by the implementation — it is silently dropped, same pattern as pdfCreateSetOCGStateAction's PreserveRB. Its name implies an option to push the previous visibility onto some kind of undo/restore stack before overwriting it, but no such stack exists anywhere in the codebase; the call always performs a plain, non-reversible overwrite regardless of SaveState's value.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Handle | Handle of an existing OCG (1-based). |
Visible | New default-configuration visibility. |
SaveState | Accepted but silently dropped — no prior-state save/restore mechanism exists regardless of value. |
Return value. True if Handle resolved to an existing OCG; False otherwise.
See also. pdfSetOCGConfigState (the per-alternate-configuration sibling), pdfCreateSetOCGStateAction.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetOCGState
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.