THotPDF.ExtractEmbeddedFileBytes Method
Extracts embedded file stream bytes by filename from the currently loaded PDF document. Use it to retrieve Factur-X XML, supporting attachments, or other embedded payloads found in the name tree
Declaration
function ExtractEmbeddedFileBytes(const AFileName: AnsiString; out ABytes: TBytes): boolean;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
AFileName | Embedded file name as stored in the loaded document name tree |
ABytes | Receives the embedded file stream bytes when the method returns True |
Return value
Returns True when the requested embedded file bytes are found and copied
Usage notes
- The method reads the EmbeddedFile stream from the loaded object graph and restores the stream position after copying
- Use this method for general PDF embedded files and use ExtractFacturXXML for the detected hybrid invoice XML
- The output byte array is cleared when the embedded file cannot be found