pdfCreateOCMD
Create an optional-content membership dictionary — visibility
| Category | Optional content |
|---|
Purpose — Create an optional-content membership dictionary — visibility driven by a boolean policy over a *set* of OCGs, rather than one OCG alone.
Description — Resolves each handle in OCGs to a live OCG (invalid entries are silently dropped); fails if none resolve. Stores the member set and Visibility policy, and returns a handle in the disjoint OCMD range (1,000,000 + index + 1) usable directly with pdfBeginLayer. Visibility is written to the serialized /OCMD /P entry: ovAllOff→AllOff, ovAllOn→AllOn, ovAnyOff→AnyOff, ovAnyOn→AnyOn; ovNotSet omits /P (PDF viewers then default to AnyOn per spec).
Declarations
int32_t __stdcall pdfCreateOCMD(PPDF IPDF, TOCVisibility Visibility, uint32_t* OCGs, uint32_t Count);
function pdfCreateOCMD(const IPDF: PPDF; Visibility: TOCVisibility; const OCGs: PCardinal; Count: Cardinal): Integer; stdcall; external 'LumasPdf.dll';
TOCVisibility:
TOCVisibility = (ovAllOff, ovAllOn, ovAnyOff, ovAnyOn, ovNotSet);
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Visibility | TOCVisibility | Membership visibility policy — real, reaches the serialized file. |
OCGs | uint32_t* | Array of OCG handles to include. |
Count | uint32_t | Number of entries in OCGs. |
Return value — OCMD handle (>= 1,000,001) on success; 0 if Count is 0, OCGs is NULL, or none of the given handles resolve to a live OCG.
See also — pdfBeginLayer, pdfCreateOCG
C# (P/Invoke)
public static extern int pdfCreateOCMD(IntPtr IPDF, TOCVisibility Visibility, uint[] OCGs, uint Count);
Object Creation
pdfCreateOCMD
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.