How to: Create a ZUGFeRD-Compliant PDF Invoice
The PdfDocument.AttachZugferdInvoice method allows you to attach a ZUGFeRD-compliant XML to the PDF document. PDF Document API fully supports ZuGFeRD e-invoicing standard (including ZuGFeRD v2.5).
The following versions are supported:
| Version | Description |
|---|---|
| Version1_0 | Original ZUGFeRD 1.0 format |
| Version2_0_1 | ZUGFeRD 2.0.1+ |
| Version2_1 | ZUGFeRD 2.1+ (compatible with v2.1 - v2.3) |
| Version2_3_2 | ZUGFeRD 2.3.2+ (compatible with v2.3.2 - v2.5) |
The following code sample attaches an invoice and saves the result:
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
pdfDocumentProcessor.LoadDocument("Invoice.pdf");
pdfDocumentProcessor.Document.AttachZugferdInvoice
(File.ReadAllBytes("ZUGFeRD-invoice.xml"));
pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf");
}
Note
Consider the following when you attach a ZUGFeRD-compliant XML:
- The
PdfDocumentProcessordoes not validate the attached invoice. - The
AttachZugferdInvoicemethod does not convert the document to a PDF/A-3b compatible file. Make sure that your document is PDF/A-3b compliant.