Takumi

Attachments

Embed files in the PDF, including PDF/A-3 e-invoice data

Attach files with attachments. They appear in the viewer's attachment panel:

const  = await (, {
  : [
    {
      : "factur-x.xml",
      : ,
      : "application/xml",
      : "Factur-X invoice data",
      : "alternative",
    },
  ],
});

data takes raw bytes as a Uint8Array, or a string encoded as UTF-8.

relationship states how the file relates to the document. It becomes the PDF/A-3 AFRelationship:

ValueMeaning
"source"The document was created from this file.
"alternative"An alternative representation of the document.
"data"The file backs a visual presentation in the PDF.
"supplement"Additional resources for the document.
"unspecified"No clear relationship. The default.

Electronic invoices

ZUGFeRD and Factur-X invoices are PDF/A-3 documents with the invoice XML attached. Combine attachments with pdfa:

const  = await (, {
  : "3b",
  : { : "Invoice 1042", : "2026-08-06" },
  : [
    {
      : "factur-x.xml",
      : ,
      : "application/xml",
      : "Factur-X invoice data",
      : "alternative",
    },
  ],
});

The PDF/A-3 levels require three fields on each attachment:

  • mimeType
  • description
  • a modification date: modificationDate, or the metadata.creationDate fallback

A missing field fails the render with the violated rule.

Invalid combinations are TypeScript type errors. The PDF/A-2 levels and "4" forbid attachments. The PDF/A-3 levels require mimeType and description on each one.

Full Factur-X conformance also expects its XMP extension schema. Takumi does not write it yet.

Last updated on

On this page