The ZUGFeRD / Factur-X standard is a hybrid electronic invoice format that consists of two parts:

  • A PDF visual, human-readable representation of the invoice.

  • An XML file that contains invoice data in a structured form that can be processed automatically.

TX Text Control X19 supports the embedding of attachments in PDF/A-3b documents and also the extraction of an attachment. This sample shows 3 steps of the creation process using TX Text Control:

  • Creating the required ZUGFeRD XML.
  • Creating the visual representation.
  • Export both to a valid PDF/A-3b document.

Embedding Existing XML

In case, you already have a valid XML representation created by a third-party tool or an ERP system, you can easily embed this XML to a PDF document using the Save TX Text Control .NET for Windows Forms
TXTextControl Namespace
ServerTextControl Class
Save Method
Saves the complete contents of a document with the specified format.
method by specifying an EmbeddedFile TX Text Control .NET for Windows Forms
TXTextControl Namespace
EmbeddedFile Class
The EmbeddedFile class represents a file embedded in another document.
in the SaveSettings.



For demo purposes, we implemented the helper class TXTextControl.DocumentServer.PDF.Zugferd.Invoice that creates a valid ZUGFeRD XML. The method CreateSampleInvoice returns the required XML that is embedded into the created PDF document.


In the sample application, a very simple template is used to create the visual representation of the invoice:

ZUGFeRD Template

The following code loads the template into a TextControl and uses MailMerge TX Text Control .NET for Windows Forms
DocumentServer Namespace
MailMerge Class
The MailMerge class is a .NET component that can be used to effortlessly merge template documents with database content in .NET projects, such as ASP.NET web applications, web services or Windows services.
to merge the sample data into the document. The CreateXml method of the Invoice class returns the valid ZUGFeRD XML. Together with the required meta data, the XML is embedded and exported to a valid PDF/A-3b document.



The XML document that is embedded in the PDF is listed below:


In Acrobat Reader

When the resulting PDF document is opened in Acrobat Reader, you can check the PDF/A-3b conformance using the Standards tab:

ZUGFeRD Template

Additionally, you can verify the attachments:

ZUGFeRD Template

Validating the Conformance

After validating the ZUGFeRD document using validation services such as the ZF/FX Validation (, you can see that the created document passes all tests:

ZUGFeRD Template

You can download the sample project from our GitHub repository that contains the ZUGFeRD helper classes to create a valid XML document from scratch.