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);
}
}
}
}
Imports System
Imports System.IO
Imports SautinSoft
Imports SautinSoft.Pdf
Imports SautinSoft.Pdf.Content
Namespace Sample
Class Sample
''' <summary>
''' Convert PDF to PDF-A ZUGFeRD using VB.NET and .NET.
''' </summary>
''' <remarks>
''' Details: https://sautinsoft.com/products/pdf/help/net/developer-guide/convert-pdf-to-pdfa-zugferd.php
''' </remarks>
Shared Sub Main(args As String())
' Before starting this example, please get a free trial key:
' https://sautinsoft.com/start-for-free/
' Apply the key here:
' PdfDocument.SetLicense("...")
Dim inpFile As String = "..\..\..\ZUGFeRD\ZUGFeRD.pdf"
Dim outFile As String = "..\..\..\ZUGFeRD\ZUGFeRD_Result.pdf"
Dim xmlInfo As String = "..\..\..\ZUGFeRD\ZUGFeRD.xml"
' Load a PDF document.
Using document = PdfDocument.Load(Path.GetFullPath(inpFile))
' Create PDF save options.
Dim pdfOptions As New PdfSaveOptions() With {
.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)
End Using
End Sub
End Class
End NamespaceIf you need a new code example or have a question: email us at support@sautinsoft.com or ask at Online Chat (right-bottom corner of this page) or use the Form below: