API referenceCore SDK

pdfGetOCG

Read back a layer's handle/name.

CategoryOptional content

Purpose — Read back a layer's handle/name.

Description — Fills Value with the OCG's own handle and its current display name (ANSI only — NameW is always nil; the record has a wide slot for ABI shape but this build only populates the ANSI form).

Declarations

C
BOOL32 __stdcall pdfGetOCG(PPDF IPDF, uint32_t Handle, TPDFOCG* Value);
Delphi
function pdfGetOCG(const IPDF: PPDF; Handle: Cardinal; var Value: TPDFOCG): LongBool; stdcall; external 'LumasPdf.dll';

TPDFOCG:

Delphi
TPDFOCG = record
  StructSize: Cardinal;
  Handle:     Cardinal;
  NameA:      PAnsiChar;
  NameW:      PWideChar;   // always nil in this build
end;

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
HandleCardinalOCG handle to look up.
ValueTPDFOCG*Receives the info. StructSize is not written by this call.

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

Memory & buffersValue.NameA points into an engine-owned buffer valid until the next pdfGetOCG call on the same handle or instance deletion.

See alsopdfGetOCGCount

C# (P/Invoke)

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

Getters

Exported names

pdfGetOCG

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.