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
Overview
This guide shows you how to create a Factur-X invoice - a PDF document with embedded XML data that follows international electronic invoicing standards - by:
- Generating a PDF invoice
- Embedding a structured XML file within the PDF
Step-by-Step Solution
1. Prepare the XML Data
First, you need an XML file that contains the structured invoice data. You have two options:
- Create the XML file manually
- Generate it using Carbone with an XML template
2. Create the Invoice PDF
Design the template. You can get inspiration in our basic invoice template.
3. Attach the XML File
Use the :attachFile formatter to embed the XML:
- Syntax:
:attachFile('factur-x.xml') - The formatter automatically:
- Detects the Conformance Level from your XML ('MINIMUM', 'BASIC WL', 'BASIC', 'EXTENDED', 'EN 16931')
- Sets appropriate PDF metadata
- Uses PDF Version 3B (if not specified otherwise)
Advanced Options: You can specify the PDF relationship type using :attachFile(filename, type):
- Available types: "Source", "Data" (default), "Alternative", "Supplement", "Unspecified", "FormData", "Schema"
Process Flow
1- Template
┌─────────────────┐
│ *.docx │ ┌─────────┐
│ ┼───┐ │ │
│ :attachFile │ │ │ │
│ ('factur-x.xml')│ └───► │ Export
└─────────────────┘ │ Carbone │ ┌───────┐
│ │ │ *.pdf │
2- Data ┌───► ┼────► ┌─┴┐
┌───────┐ │ │ │ │ │┌┐│
│*.json ┼───┘ │ │ └─────┤│││
└───────┘ ┌─► │ │ │
│ │ │ └─┘*.xml
3- XML │ │ │
┌───────┐ │ └─────────┘
│*.xml ┼─────┘
└───────┘
Related Examples
Trusted by 600+ paid customers in 40+ countries
Finance
Healthcare
Public
Retail
Industries
Energy
Software
Telecom














