API referenceCore SDK

pdfDeleteOCGFromDisplayTree

Remove a layer from the viewer's layer panel (/OCProperties

CategoryOptional content
AvailabilityPartial — Recursive parameter unused — see Remarks

Purpose — Remove a layer from the viewer's layer panel (/OCProperties /D /Order) without deleting the layer object itself.

Description — Clears the OCG's in-order flag; the OCG dictionary and its content-stream references remain intact (existing /OC /OCn BDC scoping still works and the layer can still be toggled programmatically) — only its entry in the display tree is suppressed, so end users no longer see it listed in the viewer's layers panel.

Declarations

C
BOOL32 __stdcall pdfDeleteOCGFromDisplayTree(PPDF IPDF, uint32_t OCGHandle, BOOL32 Recursive);
Delphi
function pdfDeleteOCGFromDisplayTree(const IPDF: PPDF; OCGHandle: Cardinal; Recursive: LongBool): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
OCGHandleCardinalOCG handle to remove from the display tree.
RecursiveBOOL32Accepted for ABI compatibility; not applied — see Remarks.

Return valueTRUE on success; FALSE if OCGHandle is out of range.

Remarks — compatibility parameters. Recursive is intended (per the reference ABI) to also remove nested display-tree children under this layer via pdfAddLayerToDisplTree parent/child relationships, but this build only clears the flag on the given handle — nested UI-tree nodes added under it are unaffected regardless of Recursive's value.

C# (P/Invoke)

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

Core

Exported names

pdfDeleteOCGFromDisplayTree

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.