In this chapter of our manual, we will show you how you can create ZUGFeRD compliant PDF invoices (France Factur-X) with our PDF printer.

As always, the core application is our PDF printer, because it offers the creation of PDF/A-3b files as the basis for ZUGFeRD compliant PDF documents. This PDF specification is the basis for attaching additional files to PDF documents, in the case of ZUGFeRD these are XML files.

7-PDF Attach Extract and Remove (ZUGFeRD) Tool

The process of attaching so-called attachments to PDF files is as follows: 7-PDF Printer first prints the required PDF/A-3b document in PDF format 1.7, and our software PDFAttachExtractAndRemoveFiles.exe, used here as a plug-in application, finally attaches the desired file attachment to the previously printed PDF/A-3b document.

The "7-PDF Attach Extract and Remove PDF Tool" (PDFAttachExtractAndRemoveFiles.exe), as we officially call our software, can be downloaded here on this page can be downloaded separately from the PDF printer setup and installed and used to generate PDF ZUGFeRD (e-invoices) in conjunction with our PDF printer. The tool also supports you in attaching other invoice-related files such as general terms and conditions, order confirmations, etc. to the PDF e-invoice after it has been generated. So it's worth taking a closer look at the tool!

7-PDF Attach Extract and Remove PDF Tool -> PDFAttachExtractAndRemoveFiles.exe started as desktop application
7-PDF Attach Extract and Remove PDF Tool -> PDFAttachExtractAndRemoveFiles.exe started as desktop application

"PDFAttachExtractAndRemoveFiles.exe" as a desktop or console application

"PDFAttachExtractAndRemoveFiles.exe", the 7-PDF Attach Extract and Remove Tool, is a special hybrid application, i.e. it can be used as a pure desktop application (double-click on PDFAttachExtractAndRemoveFiles.exe), but also offers a Console and Hidden Mode for hidden, fully automatic program execution. You can also use the application via a DOS box or in the Windows command prompt like a DOS application.

The following screenshot shows the possible parameters for controlling the program as a console application:

Run PDFAttachExtractAndRemoveFiles.exe in the Windows 11 command prompt as a console application
Run PDFAttachExtractAndRemoveFiles.exe in the Windows 11 command prompt as a console application. Use the parameter /? to get help for the program

However, the prerequisite for successfully attaching files to PDF documents is that your PDF conforms to the PDF standard PDF/A-3b and version 1.7. As already described, this format can be generated by our PDF printer.

Use "PDFAttachExtractAndRemoveFiles.exe" with 7-PDF Printer as a plug-in

In order to print ZUGFeRD-compliant PDF invoices fully automatically with our PDF printer 7-PDF Printer, the application PDFAttachExtractAndRemoveFiles.exe must first be installed. The following screenshot shows the setup of our tool and the standard installation path. As a plug-in, the application is later called up by 7-PDF Printer when printing the invoice and is run in hidden mode by default.

After installation, PDFAttachExtractAndRemoveFiles.exe can be used as a plug-in application directly from our PDF printer.
After installation, PDFAttachExtractAndRemoveFiles.exe can be used as a plug-in application directly from our PDF printer.

Create ZUGFeRD PDF automatically with 7-PDF Printer

If PDFAttachExtractAndRemoveFiles.exe is copied into the installation directory as a plug-in application, we still need the macro ZUGFeRD.vbs required for fully automatic creation of ZUGFeRD compliant PDF files with 7-PDF Printer.

You will find a ZIP archive in the download table below with the name PlugIn_ZUGFeRD_7PDF_Printer.zip which contains this macro and other required files. As usual with our PDF printer, the macro ZUGFeRD.vbs belongs in the Macros folder. So copy the VBS file into this directory.

ZUGFeRD.vbs macro must be placed in the macros folder of the 7-PDF Printer
ZUGFeRD.vbs macro must be placed in the macros folder of the 7-PDF Printer

After printing the required PDF/A-3b document, the macro automatically calls PDFAttachExtractAndRemoveFiles.exe and automatically attaches the ZUGFeRD compliant XML invoice file corresponding to the invoice to the printed PDF.

ZUGFeRD.vbs macro must be placed in the macros folder of the 7-PDF Printer
The really important line is the second to last line in the VB Script Macro. Here PDFAttachExtractAndRemoveFiles.exe is called by the 7-PDF printer in Hidden Mode and all parameters required for attaching the XML file are added. The path may need to be adjusted for older Windows versions.

Simulated invoice printing

As a simulation example, we use the following sample invoice (downloadable below). For this test or example, printing is done from Word, normally printing is done from an ERP system or inventory management system to a 7-PDF printer.

Example invoice with invoice number marked in red
Example invoice with invoice number marked in red.
Note: The sample calculation is also available as a download below.

The invoice number is marked in red in the invoice document for pure illustration, because this part of the print data extracts the macro ZUGFeRD.vbs placed above to pass the ZUGFeRD XML file suitable for the print data, which was previously stored by the ERP system under C:\einvoices, to ZUGFeRD.exe so that it appends the XML to the generated PDF/A-3b file. So there is a ZUGFeRD compliant XML file in this directory named 2021-09-1911.xml.

In the above mentioned ZIP archive with the name PlugIn_ZUGFeRD_7PDF_Printer.zip (download via download table below) you will also find a zipped directory einvoices which should enable you to run through our example shown here.


In this directory, the ERP has previously stored the XML ZUGFeRD data per invoice as an example. The file name is equal to the invoice number from the print data and is extracted by the macro ZUGFeRD.vbs and passed to our PDFAttachExtractAndRemoveFiles.exe.

Start simulation

We hold: PDFAttachExtractAndRemoveFiles.exe is installed in its standard path, ZUGFeRD.vbs is stored in the Macros directory of 7-PDF Printer, and the einvoices directory is unpacked directly under C:\. We then print out our example calculation from Word on the 7-PDF Printer for simulation.

Example invoice with invoice number marked in red
Example invoice with invoice number marked in red.

The print dialog of our PDF printer is displayed, we press the "Save" button after selecting the location for the PDF/A-3b file to be created.

Print dialog of the 7-PDF Printer appears
Print dialog of the 7-PDF Printer appears

The result

The result is a PDF/A-3b invoice document with an attached ZUGFeRD-compliant XML file, as Adobe's Acrobat Reader impressively shows us.

ZUGFeRD compliant PDF invoice in Acrobat Reader
ZUGFeRD compliant PDF invoice in Acrobat Reader

Why is e-invoice validation important?

E-invoices must be valid to be considered for tax deduction in VAT returns. Another critical aspect is machine processing: If the XML is invalid, automatic processing in downstream systems may fail.

Our Solution: The 7-PDF Validator

7-PDF E-Invoice Validator as a desktop application

Our tool addresses this issue: It enables the validation of e-invoices in the XRechnung and PDF ZUGFeRD formats. Your incoming and outgoing invoices are checked against the DIN EN 16931 schema. Additionally, the validator verifies whether the e-invoice document complies with VAT regulations and can be legally accepted by you or your invoice recipient.

Key considerations:

  • The PDF document should be compliant with the PDF/A-3 standard (long-term archiving).
  • The XML of the e-invoice must be properly embedded. (Note: Our tool 7-PDF Attach Extract and Remove ensures that XML e-invoices are correctly embedded in a PDF/A-3 document.)

Automatic and manual validation

Our validator checks all these requirements fully automatically in CLI/console mode and provides appropriate feedback, which you or our PDF printer can respond to. To facilitate integration, we have already included the validator in our macro ZUGFeRD.vbs. If necessary, it is automatically installed and configured on your system. Alternatively, you can also validate e-invoices manually via the user interface.

Setup and use of our online validation service

During setup, you will be asked if you agree to validation via our online service. For this example, you can confirm with "Yes".

Important note for productive use:

If you plan to use the validator in production, please note that your invoice data is sent to our online validation service. This service is hosted on a server in Germany (STRATO).

🔒 Security and Data Protection:

  • Your data is only stored, processed, and validated for the duration of the validation.
  • Afterward, it is automatically deleted.
  • The transmission is always SSL-encrypted.

In the following screenshot, the VBScript code line that triggers this validation process is highlighted.

ZUGFeRD.vbs macro must be placed in the macros folder of the 7-PDF Printer
Important line in the VB Script macro. Here, SevenPDFValidator.exe is executed by the 7-PDF Printer in Hidden Mode with all necessary parameters to validate the e-invoice.

Automatic feedback in the PDF printer

If your e-invoice is not valid, our PDF printer will display a corresponding notification. This happens because the exit code of the validator was not 0 (OK) but 1 (Error).

📌 More information & download

Are you interested in our 7-PDF E-Invoice Validator? More details can be found on the product page:

👉 Go to the 7-PDF E-Invoice Validator!

Only a special PDF printer instance should print ZUGFeRD PDF documents

7-PDF Printer supports the installation of several PDF printer instances via the setup parameter /PRINTERNAME="[REQUIRED PDF PRINTER NAME]". Different PDF settings can then be made for each printer instance. However, macros such as ZUGFeRD.vbs are placed globally in the macros folder, and actually apply to every installed printer instance. So, in plain language, the programming affects every printer instance based on 7-PDF Printer.

But you can query the variable PrinterName (line 15) in the VB Script code, and thus provide the ZUGFeRD.vbs code only for a specific printer instance. In the code snippet below, in this case it is the default PDF printer instance with the familiar name "7-PDF Printer". Here, all the code has simply been bracketed into a VBScript IF condition. So the code for ZUGFeRD documents is only executed if a print was done via the 7-PDF Printer.

So the code for ZUGFeRD documents is only executed if a print was done via the 7-PDF Printer.
ZUGFeRD documents are only created via the printer instance 7-PDF Printer.

Pay attention to printer driver

7-PDF Printer can be installed as a central PDF network printer in addition to a classic installation as a desktop application or a local PDF printer installation (default). The installation-parameter for this is /SHARE.

After installation as a PDF network printer, it may be necessary to change the printer driver selected after installation to 7-PDF Printer, as shown in the screenshot below, to create ZUGFeRD PDF documents. For higher compatibility a Postscript driver of the operating system is used if necessary. In the case of ZUGFeRD, however, we need direct access to print data, and this is only possible if the PDF network printer instance (in the screenshot "PDF-EXP-Prt") is operated under the printer driver "7-PDF Printer". So you should have a look here, that the printer instance also uses the correct printer driver.

For ZUGFeRD the correct driver must be used!
For ZUGFeRD the correct driver 7-PDF Printer must be used!

Note: Starting with Windows 10, you must temporarily disable printer sharing for the duration of the driver change, otherwise you will receive an operating system error message.

Conclusion

The simulation example listed here extracts print information via the supplied macro programming ZUGFeRD.vbs. The stored programming expects a layout that corresponds to the invoice sample file from Word.

For your requirements the macro ZUGFeRD.vbs would have to be adapted if necessary. With a little VB Script or programming knowledge under Visual Basic, the programming supplied here can be adapted quite quickly itself. If you have no programming experience, we also offer appropriate know-how. Just contact us via Support form, we will help you and try to realize your requirements.

Supported ZUGFeRD versions and Factur-X 1.0

PDFAttachExtractAndRemoveFiles.exe supports the attachment of already ZUGFeRD compliant XML documents of the EU standard of EN 16931. This includes besides the ZUGFeRD versions 1.0, 2.0, 2.1 also Factur-X 1.0 (France). The abbreviation ZUGFeRD stands for the specification "Central User Guide of the Forum Electronic Invoice Germany" and is a format for the exchange of electronic invoice documents.

Attach other file types to PDF/A-3b

In the desktop mode of our 7-PDF Attach Extract and Remove Tool Version 1.0.0.174 (PDFAttachExtractAndRemoveFiles.exe) you can attach not only XML documents to PDF/A-3b compliant documents, but also all other valid file types such as *.pdf, *.docx, *.xlsx, *.pptx, *.rtf, etc. The tool supports the attachment of these files in normal GUI mode but also in CLI mode, i.e. via console, and can be very useful for automating your e-invoicing processes!

Top