Invoice Automation / Factur-X
Generate PDF Invoices with Carbone
- Template type document docx simple
- Carbone min. v4.0.0+
- Features factur-X
- Target invoice contract custom
Objectives
Create a Factur-X invoice with the following feature:
- Attach an XML-file to the generated invoice.
Solution
Once the invoice template is ready, follow these steps to generate a Factur-X document with Carbone:
Generate the XML file to attach to the Factur-X invoice:
- You can create this XML file manually.
- Alternatively, you can use Carbone (with a
template.xml
)
Use the :attachFile formatter
To generate a file compliant with the Factur-X standard, you must use the
:attachFile('factur-x.xml')
formatter, specifically withfactur-x.xml
as the first parameter. It automatically detects the Conformance Level from the attached XML ('MINIMUM', 'BASIC WL', 'BASIC', 'EXTENDED', 'EN 16931') and adjusts the PDF metadata accordingly. Additionally, it setsSelectPdfVersion = 3
(PDF Version 3B) by default if not specified and if the output file is a PDF.Note: Add a
type
parameter to the :attachFile(filename, type) formatter to specify the PDF AFRelationship. Options fortype
include: "Source", "Data" (default), "Alternative", "Supplement", "Unspecified", "FormData", and "Schema".
And there you go!
1- Template
┌─────────────────┐
│ *.docx │ ┌─────────┐
│ ┼───┐ │ │
│ :attachFile │ │ │ │
│ ('factur-x.xml')│ └───► │ Export
└─────────────────┘ │ Carbone │ ┌───────┐
│ │ │ *.pdf │
2- Data ┌───► ┼────► ┌─┴┐
┌───────┐ │ │ │ │ │┌┐│
│*.json ┼───┘ │ │ └─────┤│││
└───────┘ ┌─► │ │ │
│ │ │ └─┘*.xml
3- XML │ │ │
┌───────┐ │ └─────────┘
│*.xml ┼─────┘
└───────┘
You might also like
Trusted by 600+ paid customers in 40+ countries














