XMP Data for generated ZUGFeRD is not valid

Hi Aspose team,
we would like to create ZUGFerd-compliant PDF files with Aspose. In principle, this works quite well.
However, when checking the generated PDF file, we noticed that the XMP data in the PDF file
are not quite correct.

The following information is not correct:

  • Zugferd version:
    Always seems to be 1.0. However, this should depend on the embedded XML file and could therefore also be 2.0
  • Zugferd ConformanceLevel:
    Always appears to be EXTENDED. However, this should depend on the XML file included and could therefore also be BASIC, for example

Is there a way to configure this data in the course of generating the Zugferd or to do this by directly modifying the XMP data?

Content of XMP-data created by Aspose


pdfaExtension:schemas
rdf:Bag
<rdf:li rdf:parseType=“Resource”>
pdfaSchema:schemaZUGFeRD PDFA Extension Schema</pdfaSchema:schema>
pdfaSchema:namespaceURIurn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#</pdfaSchema:namespaceURI>

</rdf:li>
</rdf:Seq>
</pdfaSchema:property>


<rdf:Description rdf:about=“” xmlns:zf=“urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#”>
zf:DocumentFileNamezugferd-invoice.xml</zf:DocumentFileName>
zf:DocumentTypeINVOICE</zf:DocumentType>
zf:Version1.0</zf:Version>
zf:ConformanceLevelEXTENDED</zf:ConformanceLevel>
</rdf:Description>

Wanted content of XMP-data


pdfaExtension:schemas
rdf:Bag
<rdf:li rdf:parseType=“Resource”>
pdfaSchema:schemaZUGFeRD PDFA Extension Schema</pdfaSchema:schema>
pdfaSchema:namespaceURIurn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#</pdfaSchema:namespaceURI>

</rdf:li>
</rdf:Seq>
</pdfaSchema:property>

<rdf:Description xmlns:zf="urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#" rdf:about="">
  <zf:DocumentFileName>zugferd-invoice.xml</zf:DocumentFileName>
  <zf:DocumentType>INVOICE</zf:DocumentType>
  <zf:Version>2p0</zf:Version>
  <zf:ConformanceLevel>BASIC</zf:ConformanceLevel>
</rdf:Description>

Kind regards
Matthias

@curmas

Hi Matthias,

To resolve the issues with the XMP data in your ZUGFeRD-compliant PDF files, you will need to modify the XMP metadata directly after generating the PDF. Currently, Aspose.PDF does not offer built-in options to automatically set the ZUGFeRD version and conformance level based on the embedded XML file. Therefore, manual updates to the XMP data are necessary.

Here’s a basic example of how to modify the XMP metadata using Aspose.PDF:

using Aspose.Pdf;
using Aspose.Pdf.Xmp;

Document pdfDocument = new Document("yourfile.pdf");

// Create a new XmpMetadata object
XmpMetadata xmpMetadata = new XmpMetadata();

// Set the desired values
xmpMetadata.SetProperty("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#", "Version", "2p0");
xmpMetadata.SetProperty("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#", "ConformanceLevel", "BASIC");

// Add the XMP metadata to the PDF document
pdfDocument.XmpMetadata = xmpMetadata;

// Save the updated PDF
pdfDocument.Save("updatedfile.pdf");

In this example, replace "yourfile.pdf" with the path to your original PDF and set the appropriate values for the ZUGFeRD version and conformance level. This will ensure that the XMP data accurately reflects your requirements.

Please proceed with these steps, and let me know if you have any further questions or need additional assistance!

Best regards,
[Your Name]