Back to Devexpress

How to: Create a ZUGFeRD-Compliant PDF Invoice

officefileapi-402991-pdf-document-api-examples-pdf-graphics-and-additional-content-how-to-create-zugferd-compliant-invoice.md

latest1.4 KB
Original Source

How to: Create a ZUGFeRD-Compliant PDF Invoice

  • Dec 12, 2024

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:

csharp
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("Invoice.pdf");
    pdfDocumentProcessor.Document.AttachZugferdInvoice
        (File.ReadAllBytes("ZUGFeRD-invoice.xml"));
    pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf");
}
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
    pdfDocumentProcessor.LoadDocument("Invoice.pdf")
    pdfDocumentProcessor.Document.AttachZugferdInvoice
        (File.ReadAllBytes("ZUGFeRD-invoice.xml"))
    pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf")
End Using

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.