myollie / img2pdf

losslessly convert images to pdf
58 stars 6 forks source link

Vera PDF validation fails with metadata tags #6

Open JTe-git opened 1 year ago

JTe-git commented 1 year ago

Vera PDF validation is failing when using metadata tags with en error:

If a document information dictionary does appear at a document, then all of its entries that have analogous properties in predefined XMP schemas, shall also be embedded in the file in XMP form with equivalent values.

Specification: ISO 19005-1:2005, Clause: 6.7.3, Test number: 1

Vera PDF can fix this, but it would be good to have the correct format directly with img2pdf. The legacy tags are as at the moment:

<< /Author (--Author Name--) /CreationDate (D:20231016123139Z) /Creator (--Document Creator--) /ModDate (D:20231016123139Z) /Producer (img2pdf 0.4.4) >>

Current img2pdf generated XMP:

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP toolkit 2.9.1-13, framework 1.6">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:iX="http://ns.adobe.com/iX/1.0/">
  <rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="" pdf:Producer="img2pdf 0.4.4"/>
  <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
    <xmp:ModifyDate>2023-10-16T11:41:13Z</xmp:ModifyDate>
    <xmp:CreateDate>2023-10-16T11:41:13Z</xmp:CreateDate>
  </rdf:Description>
  <rdf:Description xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/" rdf:about="" pdfaid:part="1" pdfaid:conformance="B"/>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>

The validated XMP code generated by Vera PDF (notice for Creator we use xmp:CreatorTool and for Author pdfaid and dc:creator as there is no xmp:Author):

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.0-jc003">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about=""
        xmlns:pdf="http://ns.adobe.com/pdf/1.3/"
        xmlns:xmp="http://ns.adobe.com/xap/1.0/"
        xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/"
        xmlns:dc="http://purl.org/dc/elements/1.1/">
      <pdf:Producer>img2pdf 0.4.4</pdf:Producer>
      <xmp:ModifyDate>2023-10-16T08:42:23Z</xmp:ModifyDate>
      <xmp:CreateDate>2023-10-16T11:41:13Z</xmp:CreateDate>

      <xmp:CreatorTool>--Document Creator--</xmp:CreatorTool>
      <pdfaid:conformance>B</pdfaid:conformance>
      <pdfaid:part>1</pdfaid:part>
      <dc:creator>
        <rdf:Seq>
          <rdf:li>--Author Name--</rdf:li>
        </rdf:Seq>
      </dc:creator>

    </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>
<?xpacket end="w"?>