WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

PDF Conformance in XMP metadata

Open pmjdebruijn opened this issue 1 month ago • 2 comments

Currently Weasyprint does not seem to add any XMP metadata. Here's an example extract from a LibreOffice PDF:

libreoffice-pdf-xmp.txt

The PDF Conformance metadata is particularly useful as it allows PDF readers to more accurately show the conformance:

https://github.com/mate-desktop/atril/blob/2521fb43d84297f03a6e31125d3e9ce0d2b0b989/backend/pdf/ev-poppler.cc#L422

pmjdebruijn avatar Nov 09 '25 15:11 pmjdebruijn

Thanks for the report.

We already add this information in PDF/A, for example. I think that it’s actually mandatory. The structure is a bit different though:

In WeasyPrint:

<rdf:Description rdf:about="" pdfaid:part="3" pdfaid:conformance="B" />

In LibreOffice:

  <rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
   <pdfaid:part>3</pdfaid:part>
   <pdfaid:conformance>B</pdfaid:conformance>
  </rdf:Description>

We have to check the specification to know what’s the right way to store this.

liZe avatar Nov 12 '25 17:11 liZe

Both syntaxes are actually possible:

Property and structure field elements that have normal (non-URI) simple, unqualified values may be replaced with attributes in the rdf:Description element.

And your PDF reader should get it here: https://github.com/mate-desktop/atril/blob/2521fb43d84297f03a6e31125d3e9ce0d2b0b989/backend/pdf/ev-poppler.cc#L431

Do you have the problem with PDF/A files generated by WeasyPrint?

liZe avatar Nov 12 '25 21:11 liZe