API referenceImport & Output APIs

pdfGetEmbeddedFile

Read an attachment's bytes and obtain the node/filespec object

Exported namespdfGetEmbeddedFile

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).

C
BOOL32 __stdcall pdfGetEmbeddedFile(PPDF IPDF, uint32_t Handle, TPDFFileSpec* FileSpec, BOOL32 Decompress);
Delphi
function pdfGetEmbeddedFile(const IPDF: PPDF; Handle: Cardinal;
  var FileSpec: TPDFFileSpec; Decompress: LongBool): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
Handleuint32_t1-based attachment handle.
FileSpecTPDFFileSpec*Receives the data pointer and object handles; zero-initialised by the call.
DecompressBOOL32Ignored — bytes are stored uncompressed and returned as-is.

Return valueTRUE on success; FALSE for an invalid instance handle, out-of-range handle, or a deleted slot.

Memory & buffersBuffer 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)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Import & Output APIs
Category

Getters

Exported names

pdfGetEmbeddedFile

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.