attachFacturX

Embeds invoice's factur-x.xml into pdf as a ZUGFeRD / Factur-X attachment and returns the new bytes.

The XML is built via FacturXInvoice.toXml (MINIMUM profile) and embedded under the catalog's embedded-files name tree with the spec-mandated file name factur-x.xml, MIME type text/xml, and an /AFRelationship of /Data (per the Factur-X specification). This mirrors the core driver's attachment path but operates standalone over existing bytes, so you can Factur-X-enable a PDF produced by any tool.

Scope: this only attaches the structured XML — it does not add or verify the PDF/A conformance Factur-X also requires. For a fully conformant document, produce the base PDF with PDF/A enabled and validate the result. See FacturXInvoice for the data-model caveats.

Return

the PDF bytes with factur-x.xml embedded.

Parameters

pdf

the human-readable invoice PDF bytes.

invoice

the structured invoice to attach.