API reference › Import & Output APIs
pdfGetEmbeddedFile
Read an attachment's bytes and obtain the node/filespec object
| Exported names | pdfGetEmbeddedFile |
|---|
Purpose — Read an attachment's bytes and obtain the node/filespec object handles for the structured getters.
Description — Fills the caller's TPDFFileSpec: Buffer/BufSize point at the stored (uncompressed) bytes; Compressed is always FALSE; INode/IFileSpec receive opaque handles for pdfGetEmbeddedFileNode / pdfGetFileSpec; IRelNode is set only when the file has an /AFRelationship (associated file).
BOOL32 __stdcall pdfGetEmbeddedFile(PPDF IPDF, uint32_t Handle, TPDFFileSpec* FileSpec, BOOL32 Decompress);
function pdfGetEmbeddedFile(const IPDF: PPDF; Handle: Cardinal;
var FileSpec: TPDFFileSpec; Decompress: LongBool): LongBool; stdcall; external 'LumasPdf.dll';
Parameters
| Parameter | Type | Description |
|---|---|---|
Handle | uint32_t | 1-based attachment handle. |
FileSpec | TPDFFileSpec* | Receives the data pointer and object handles; zero-initialised by the call. |
Decompress | BOOL32 | Ignored — bytes are stored uncompressed and returned as-is. |
Return value — TRUE on success; FALSE for an invalid instance handle, out-of-range handle, or a deleted slot.
Memory & buffers — Buffer points into an instance-owned copy that stays valid until the next pdfGetEmbeddedFile call on the same instance (or pdfDeletePDF). Copy it out before reading another attachment.
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Getters
pdfGetEmbeddedFile
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.