pdfDeleteOCGFromAppEvent
Remove event/category flags from a layer's automatic-state
| Category | Optional content |
|---|
Purpose — Remove event/category flags from a layer's automatic-state application rules (/AS array entries).
Description — Clears Categories unconditionally from the OCG's application-category bitmask. Events is cleared only when DelCategoryOnly=FALSE; when DelCategoryOnly=TRUE, only the category bits are cleared and the event bits are left untouched. The bits being cleared here are the ones set by the companion call pdfAddOCGToAppEvent (not itself part of this chapter's cluster — it lives in the same per-OCG /AS event/category bitmask, serialized to /OCProperties/D/AS). If no bits were ever added for this OCG, the call still succeeds as a no-op once the handle itself is valid.
Declarations
BOOL32 __stdcall pdfDeleteOCGFromAppEvent(PPDF IPDF, uint32_t Handle, TOCAppEvent Events, TOCGUsageCategory Categories, BOOL32 DelCategoryOnly);
function pdfDeleteOCGFromAppEvent(const IPDF: PPDF; Handle: Cardinal; Events: TOCAppEvent; Categories: TOCGUsageCategory; DelCategoryOnly: LongBool): LongBool; stdcall; external 'LumasPdf.dll';
TOCAppEvent / TOCGUsageCategory (bit flags):
TOCAppEvent = Cardinal;
const aeExport = 1; aePrint = 2; aeView = 4;
TOCGUsageCategory = Cardinal;
const oucNone = 0; oucExport = 1; oucLanguage = 2; oucPrint = 4;
oucUser = 8; oucView = 16; oucZoom = 32;
Parameters
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Handle | Cardinal | OCG handle. |
Events | TOCAppEvent | Event bits to clear (ignored when DelCategoryOnly=TRUE). |
Categories | TOCGUsageCategory | Category bits to clear — always applied. |
DelCategoryOnly | BOOL32 | TRUE = clear only Categories, leave Events untouched. |
Return value — TRUE if Handle is a valid OCG; FALSE otherwise.
See also — pdfAddOCGToAppEvent (adds the bits this call removes; not yet enriched in this chapter)
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Core
pdfDeleteOCGFromAppEvent
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.