BOOL32 __stdcall pdfGetMetadata(PPDF IPDF, TMetadataObj ObjType, int32_t Handle, uint8_t* Buffer, uint32_t* BufSize);
BOOL32 __stdcall pdfSetMetadata(PPDF IPDF, TMetadataObj ObjType, int32_t Handle, void* Buffer, uint32_t BufSize);
function pdfGetMetadata(const IPDF: PPDF; ObjType: TMetadataObj; Handle: Integer; Buffer: PByte; var BufSize: Cardinal): LongBool; stdcall;
function pdfSetMetadata(const IPDF: PPDF; ObjType: TMetadataObj; Handle: Integer; Buffer: Pointer; BufSize: Cardinal): LongBool; stdcall;
Purpose. Get/set raw XMP metadata bytes.
Description. Verified: ObjType and Handle are accepted by both functions but never consulted — per an explicit source comment on pdfSetMetadata, "document-level XMP (ObjType/Handle ignored)." Despite the ABI shape implying per-object metadata (e.g. attaching distinct XMP to a specific image or page object, selected by ObjType/Handle), both functions always operate on the single document-level /Metadata stream regardless of what ObjType/Handle specify.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
ObjType, Handle | Accepted but silently ignored — always targets document-level metadata. |
Buffer, BufSize | The XMP bytes (get: output; set: input). |
Return value. pdfGetMetadata: True if document metadata exists and was copied out. pdfSetMetadata: True if IPDF is valid.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Setters
pdfSetMetadata
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.