| Category | Optional 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
| Parameter | Type | Description |
|---|---|---|
IPDF | PPDF | Instance handle. |
Handle | Cardinal | OCG handle to look up. |
Value | TPDFOCG* | Receives the info. StructSize is not written by this call. |
Return value — TRUE if Handle is a valid OCG; FALSE otherwise.
Memory & buffers — Value.NameA points into an engine-owned buffer valid until the next pdfGetOCG call on the same handle or instance deletion.
See also — pdfGetOCGCount
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.