pdfSetOCGContUsage
Set the /Usage (application) dictionary fields for a layer —
| Category | Optional content |
|---|
Purpose — Set the /Usage (application) dictionary fields for a layer — how it should behave under View/Print/Export intents and its /CreatorInfo.
Description — Fields left at -1/empty in Value are not changed (this call only overwrites fields you explicitly set — call pdfInitOCGContUsage first so untouched fields stay -1). UserNameA/UserNameW, when non-empty, are appended to a per-OCG list rather than replacing a single value — repeated calls accumulate multiple /User /Name entries for the same OCG (see pdfGetOCGUsageUserName to enumerate them all; pdfGetOCGContUsage only ever surfaces the first one).
Declarations
BOOL32 __stdcall pdfSetOCGContUsage(PPDF IPDF, uint32_t Handle, TPDFOCGContUsage* Value);
function pdfSetOCGContUsage(const IPDF: PPDF; Handle: Cardinal; var Value: TPDFOCGContUsage): LongBool; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Handle | Cardinal | OCG handle. |
Value | TPDFOCGContUsage* | Fields to apply; -1/empty fields are left unchanged. |
Return value — TRUE on success; FALSE if Handle is out of range.
See also — pdfGetOCGContUsage, pdfGetOCGUsageUserName
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetOCGContUsage
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.