Create a Factur-X / ZUGFeRD PDF
create_invoice_pdfBuilds a Factur-X/ZUGFeRD invoice as a readable PDF/A-3b with embedded EN 16931 XML, so it can be emailed to a person and processed by accounting software.
Instructions
Builds a Factur-X / ZUGFeRD invoice: a PDF/A-3b page a person can read, with the EN 16931 XML embedded for software. Use it when the invoice goes to a person or by e-mail. For XML only, such as an XRechnung uploaded to a German public-sector portal, use create_invoice. Takes the same invoice object as create_invoice, money in integer minor units. language changes only the printed labels; the embedded XML is identical in every language. By default the PDF comes back as base64, which can be large; pass outputPath to write the file instead. Writing stays inside the server's working directory and never replaces an existing file unless overwrite is true. The same input always gives the same bytes, and nothing is sent anywhere. Check the result with validate_invoice (pass pdfBase64).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| invoice | Yes | The invoice. Required: number, issueDate, currency, seller, buyer, lines. | |
| profile | No | Factur-X / ZUGFeRD profile. Default en16931. | |
| language | No | Language of the printed labels: en, de or fr. Default en. Presentation only; the XML does not change. | |
| template | No | Page layout. Default classic. | |
| overwrite | No | Allow replacing an existing file at outputPath. Default false. | |
| outputPath | No | Write the PDF here instead of returning base64. Relative to the server working directory; must end in .pdf. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sha256 | Yes | SHA-256 of the PDF bytes, hex; equal for equal input. | |
| profile | Yes | The Factur-X / ZUGFeRD profile written. | |
| warnings | Yes | Non-fatal findings about the invoice data. | |
| pdfBase64 | No | The PDF, base64. Absent when outputPath was given. | |
| byteLength | Yes | Size of the PDF in bytes. | |
| outputPath | No | Absolute path written, when outputPath was given. | |
| xmlFilename | Yes | Name of the embedded XML attachment. | |
| conformanceLevel | Yes | Conformance level declared in the PDF metadata, e.g. EN 16931. |