ZUGFeRD is a German and European standard for hybrid electronic invoices, combining visual PDF and structured XML data. It uses the ISO 19005-3:2012 (PDF/A-3) standard to embed XML within PDF, enabling long-term storage and automated data processing.
Key aspects of ZUGFeRD and ISO:
ZUGFeRD 2.0 and later versions are often referred to as Factur-X, emphasizing their international compatibility.
Step-by-step:
Code Snippet:
string inpFile = @"..\..\..\ZUGFeRD\ZUGFeRD.pdf";
string outFile = @"..\..\..\ZUGFeRD\ZUGFeRD_Result.pdf";
string xmlInfo = @"..\..\..\ZUGFeRD\ZUGFeRD.xml";
using (var document = PdfDocument.Load(Path.GetFullPath(inpFile)))
{
// Create PDF save options.
var pdfOptions = new PdfSaveOptions()
{
Version = PdfVersion.PDF_A_3A,
FacturXXml = File.ReadAllText(xmlInfo)
};
document.Save(outFile, pdfOptions);
}
Key Features:
PDF .Net by SautinSoft supports ZUGFeRD 2.2 (Factur-X), which is fully compatible with XRechnung and European standard EN 16931. This ensures maximum compatibility across German and European systems.
SautinSoft solutions allow to receive PDF/A-3 with embedded XML meeting all requirements and you will get mandatory compliance for German public sector invoicing, Automatic Leitweg-ID validation for government routing, Built-in validation for France tax regulations.
Standards support: The library supports Factur-X (ZUGFeRD 2.2), which complies with the European standard EN 16931.
PDF/A-1A, PDF/A-1B, PDF/A-2A, PDF/A-2B, PDF/A-2U, PDF/A-3A, PDF/A-3B, PDF/A-3U, PDF/A-4E.
Cross-platform: Works on Windows, Linux, and macOS (.NET 6/7/8/9/10, Net Framework 4.6 -4.8, Standard).
Complete code
using System;
using System.IO;
using System.Reflection;
using SautinSoft;
using SautinSoft.Pdf;
using SautinSoft.Pdf.Content;
namespace Sample
{
class Sample
{
/// <summary>
/// Convert PDF to PDF-A ZUGFeRD using C# and .NET.
/// </summary>
/// <remarks>
/// Details: https://sautinsoft.com/products/pdf/help/net/developer-guide/convert-pdf-to-pdfa-zugferd.php
/// </remarks>
static void Main(string[] args)
{
// Before starting this example, please get a free trial key:
// https://sautinsoft.com/start-for-free/
// Apply the key here:
// PdfDocument.SetLicense("...");
string inpFile = @"..\..\..\ZUGFeRD\ZUGFeRD.pdf";
string outFile = @"..\..\..\ZUGFeRD\ZUGFeRD_Result.pdf";
string xmlInfo = @"..\..\..\ZUGFeRD\ZUGFeRD.xml";
// Load a PDF document.
using (var document = PdfDocument.Load(Path.GetFullPath(inpFile)))
{
// Create PDF save options.
var pdfOptions = new PdfSaveOptions()
{
//ZUGFeRD is a German and European standard for hybrid electronic invoices, combining visual PDF and structured XML data.
//It uses the ISO 19005-3:2012 (PDF/A-3) standard to embed XML within PDF, enabling long-term storage and automated data processing.
// Select the desired PDF/A version.
Version = PdfVersion.PDF_A_3A,
FacturXXml = File.ReadAllText(xmlInfo)
};
// Save a PDF document like the FacturX Zugferd.
// Read more information about Factur-X: https://fnfe-mpe.org/factur-x/
document.Save(outFile, pdfOptions);
}
}
}
}