API referenceCore SDK

pdfDeleteOCGFromAppEvent

Remove event/category flags from a layer's automatic-state

CategoryOptional 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

C
BOOL32 __stdcall pdfDeleteOCGFromAppEvent(PPDF IPDF, uint32_t Handle, TOCAppEvent Events, TOCGUsageCategory Categories, BOOL32 DelCategoryOnly);
Delphi
function pdfDeleteOCGFromAppEvent(const IPDF: PPDF; Handle: Cardinal; Events: TOCAppEvent; Categories: TOCGUsageCategory; DelCategoryOnly: LongBool): LongBool; stdcall; external 'LumasPdf.dll';

TOCAppEvent / TOCGUsageCategory (bit flags):

Delphi
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

ParameterTypeDescription
IPDFPPDFInstance handle.
HandleCardinalOCG handle.
EventsTOCAppEventEvent bits to clear (ignored when DelCategoryOnly=TRUE).
CategoriesTOCGUsageCategoryCategory bits to clear — always applied.
DelCategoryOnlyBOOL32TRUE = clear only Categories, leave Events untouched.

Return valueTRUE if Handle is a valid OCG; FALSE otherwise.

See alsopdfAddOCGToAppEvent (adds the bits this call removes; not yet enriched in this chapter)

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Core SDK
Category

Core

Exported names

pdfDeleteOCGFromAppEvent

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.