This example exports a DevExpress report to a PDF/A-3b (ISO 19005-3) document and embeds an electronic invoice (e-invoice) XML file. The resulting PDF complies with ZUGFeRD requirements and can be validated as one of the following formats:
- German e-invoice: XRechnung (ZUGFeRD container)
- French e-invoice: Factur-X (ZUGFeRD container)
The project includes standards-compliant sample XML files and XMP metadata for German (XRechnung) and French (Factur-X) e-invoice formats. Although both formats rely on the ZUGFeRD container, each country requires specific configuration settings (such as the PDF attachment relationship, the embedded XML file name, and required XMP metadata fields).
See the following specification for additional information about ZUGFeRD standarts: What is ZUGFeRD / Factur-X?
When you click the "German Specific" button, the application does the following:
- Loads two metadata fragments and concatenates them into
AdditionalMetadata. - Sets PDF/A-3b compliance.
- Attaches the
xrechnung.xmlfile with theAlternativerelationship. - Exports the report to PDF and opens the resulting PDF.
using System;
using System.Diagnostics;
using System.IO;
using DevExpress.XtraPrinting;
void ButtonExportGermany_Click(object sender, EventArgs e) {
// Create a report instance for PDF export.
using (var report = new XtraReport1())
{
report.XmlDataPath = "German//xrechnung.xml";
// Load ZUGFeRD XMP metadata fragments and concatenate them
// into a single AdditionalMetadata block.
string additionalMetadata =
File.ReadAllText("German//ZUGFeRD_DocumentInfo.txt") +
File.ReadAllText("German//ZUGFeRD_PdfASchema.txt");
// Configure PDF export options:
// - Enable PDF/A-3b compliance
// - Inject ZUGFeRD-required XMP metadata
var options = new PdfExportOptions {
PdfACompatibility = PdfACompatibility.PdfA3b,
AdditionalMetadata = additionalMetadata
};
// Attach 'xrechnung.xml' to the PDF and mark it
// as an Alternative representation.
options.Attachments.Add(new PdfAttachment {
FilePath = "German//xrechnung.xml",
Type = "text/xml",
Relationship = PdfAttachmentRelationship.Alternative,
Description = "Rechnungsdaten im ZUGFeRD-XML-Format",
});
// Export the report to a ZUGFeRD-compliant PDF file.
report.ExportToPdf("germanResult.pdf", options);
// Open the resulting PDF document.
Process.Start("germanResult.pdf");
}
}-
The UN/CEFACT Cross Industry Invoice payload is compliant with the German XRechnung profile. The report uses this file as its data source.
-
The XMP RDF fragment that contains ZUGFeRD/XRechnung metadata for the PDF document.
-
The XMP PDF/A extension schema that defines the
fxnamespace and its properties. The schema ensures that PDF/A validation correctly interpretsfx:*fields defined in ZUGFeRD_DocumentInfo.txt.
- The embedded XML file relationship must be set to
ALTERNATIVE. - The embedded XML file name must be
xrechnung.xml. - The XMP
fx:Versionvalue must match the currently valid XRechnung version (this example uses3.0, valid as 2026-01-08). - The XMP
fx:ConformanceLevelvalue must be set toXRECHNUNG.
<rdf:Description xmlns:fx="urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#" rdf:about="">
<fx:DocumentType>INVOICE</fx:DocumentType>
<fx:DocumentFileName>xrechnung.xml</fx:DocumentFileName>
<fx:Version>3.0</fx:Version>
<fx:ConformanceLevel>XRECHNUNG</fx:ConformanceLevel>
</rdf:Description>When you click the "French Specific" button, the application does the following:
- Loads two metadata fragments and concatenates them into
AdditionalMetadata. - Sets PDF/A-3b compliance.
- Attaches the
factur-x.xmlfile with theDatarelationship (Factur-X 1.0x spec). - Exports the report and opens the resulting PDF.
using System;
using System.Diagnostics;
using System.IO;
using DevExpress.XtraPrinting;
void ButtonExportFrance_Click(object sender, EventArgs e) {
// Create a report.
using (var report = new XtraReport1())
{
// Specify the Factur-X XML data source.
report.XmlDataPath = "French//factur-x.xml";
// Load ZUGFeRD XMP metadata fragments and concatenate them
// into a single AdditionalMetadata block.
string additionalMetadata =
File.ReadAllText("French//ZUGFeRD_DocumentInfo.txt") +
File.ReadAllText("French//ZUGFeRD_PdfASchema.txt");
// Configure PDF export options:
// - Enable PDF/A-3b compliance
// - Inject ZUGFeRD/Factur-X XMP metadata
var options = new PdfExportOptions {
PdfACompatibility = PdfACompatibility.PdfA3b,
AdditionalMetadata = additionalMetadata
};
// Attach the Factur-X XML file to the PDF.
// Use the Data relationship.
options.Attachments.Add(new PdfAttachment {
FilePath = "French//factur-x.xml",
Type = "text/xml",
Relationship = PdfAttachmentRelationship.Data,
Description = "Facture XML conforme Factur-X",
});
// Export the report to a Factur-X–compliant PDF file.
report.ExportToPdf("frenchResult.pdf", options);
// Open the resulting PDF document.
Process.Start("frenchResult.pdf");
}
}File to Review:
-
Factur-X (EN 16931) invoice payload (UN/CEFACT Cross Industry Invoice). The report uses this file as its data source.
-
The XMP RDF fragment that contains Factur-X-specific metadata for the PDF document.
-
The PDF/A extension schema used by Factur-X in XMP. The schema ensures that PDF/A validation correctly interprets
fx:*fields defined in ZUGFeRD_DocumentInfo.txt.
- The embedded XML file relationship must be set to
DATA. - The embedded XML file name must be
factur-x.xml. - The XMP
fx:Versionvalue must be1.0. - The XMP
fx:ConformanceLevelvalue must be set toBASIC(or another Factur-X profile based on your preferences).
<rdf:Description xmlns:fx="urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#" rdf:about="">
<fx:DocumentType>INVOICE</fx:DocumentType>
<fx:DocumentFileName>factur-x.xml</fx:DocumentFileName>
<fx:Version>1.0</fx:Version>
<fx:ConformanceLevel>BASIC</fx:ConformanceLevel>
</rdf:Description>- Form1.cs (VB: Form1.vb)
- factur-x.xml (VB: factur-x.xml)
- ZUGFeRD_DocumentInfo.txt (VB: ZUGFeRD_DocumentInfo.txt)
- ZUGFeRD_PdfASchema.txt (VB: ZUGFeRD_PdfASchema.txt)
- xrechnung.xml (VB:xrechnung.xml)
- ZUGFeRD_DocumentInfo.txt (VB:ZUGFeRD_DocumentInfo.txt )
- ZUGFeRD_PdfASchema.txt (VB:ZUGFeRD_PdfASchema.txt)
- Export to PDF
- Create a Report with a Visual PDF Signature
- Create an Invoice
- Create an Invoice from Templates
- Create a Swiss QR Bill
- How to Export a Report to PDF and Specify Export Options
- How to use the digital signature options when exporting a report to PDF
- How to Create a Custom DevExpress Report Control
- Reporting for WinForms - How to Use MailKit to Send a Report as a Document in PDF
(you will be redirected to DevExpress.com to submit your response)