Several standards define electronic invoice formats that allows the integration of electronic XML data in Adobe PDF documents. PDF/A-3 allows attachments in any format to be added to PDF documents.

PDF/A-3b

The standard itself doesn't standardize the embedded documents, but the way how they are embedded in the PDF structure. This enables applications to reliably extract the attached document from the PDF document which enables readers to extract only the embedded documents without having to open the complete PDF document itself.

Using TX Text Control, you can create those documents by adding attachments to existing or new documents that are then exported as PDF/A documents. TX Text Control can be also used to import and extract those attachments from existing PDF documents.

By standard, the attachments have several parameters that control the document. An XML attachment in the standards ZUGFeRD, ZUGFeRD 2.1, Factur-X 1.0 and XRechnung have the following parameters:

Parameter Value
Relationship Alternative
MIMEType text/xml

Import the Attachments

The following method GetXmlAttachment uses TX Text Control to load the PDF document using the Load TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
ServerTextControl Class
Load Method
Loads text in a certain format.
method. The EmbeddedFiles TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
LoadSettings Class
EmbeddedFiles Property
Specifies an array of EmbeddedFile objects providing the name, data and additional optional properties of files, which are embedded in the loaded document.
property of the LoadSettings contains an array of EmbeddedFile TX Text Control .NET Server for ASP.NET
TXTextControl Namespace
EmbeddedFile Class
The EmbeddedFile class represents a file embedded in another document.
objects after the PDF has been loaded.

Loading...

Each attachment is checked for the requirements Relationship and MIMEType in order to return the associated, embedded XML document.

The above method can be called like in the code below to extract the alternative XML invoice from a PDF/A-3b document:

Loading...