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.3.2).
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
PdfDocumentProcessor
does not validate the attached invoice. - The
AttachZugferdInvoice
method does not convert the document to a PDF/A-3b compatible file. Make sure that your document is PDF/A-3b compliant.