SetActionOCGStates
Actions, optional content
Description
Atomically replaces the ordered /State payload and optional /PreserveRB preference of an existing SetOCGState action
Syntax
Function TPDFlib.SetActionOCGStates(ActionID: Integer; Const States: Array Of TPDFlibActionOCGStateInfo; PreserveRB: Integer): Integer;Parameters
| ActionID | Handle of an existing SetOCGState action |
|---|---|
| States | Ordered group and state entries of type TPDFlibActionOCGStateInfo; the array must not be empty, every group must belong to the selected document, and repeated groups keep their positions |
| PreserveRB | -1 omits /PreserveRB, 0 stores false and 1 stores true |
Return values
| 1 | The /State payload and the optional /PreserveRB preference were replaced |
|---|---|
| 0 | The handle is invalid or not a SetOCGState action, the state list is empty or invalid, the preference is outside -1..1, or a PDF/A-1, PDF/A-2 or PDF/X-6 mode is active |
Remarks
Adjacent entries with the same state share one PDF name marker while input order and repeated group changes remain intact
All group handles are validated against the selected document before the existing payload changes
PDF/X-6 mode rejects SetOCGState actions before the existing payload changes
See also
SetFormFieldOCGStateAction, AddActionNextSetOCGState, EnumActionOCGStates