PDF /符合FOP的元数据

时间:2016-07-08 14:00:48

标签: pdf metadata apache-fop pdfa

我无法获得PDF / A-1a(根据pdfbox预检甚至不是PDF / A-1b)将PDF与元数据符合FOP 2.1。

我想说我想设置日期,语言,标题和说明:

<fo:declarations xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/" 
  xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xml:lang="de">
    <x:xmpmeta xmlns:x="adobe:ns:meta/" id="hc_meta">
        <rdf:RDF>
            <rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about="">
                <xmp:CreatorTool>hx</xmp:CreatorTool>
                <dc:language>
                    <rdf:Bag>
                        <rdf:li>de</rdf:li>
                    </rdf:Bag>
                </dc:language>
                <dc:title>
                    <rdf:Alt>
                        <rdf:li xml:lang="de">Schrieb 2016-003 - Dings AG</rdf:li>
                    </rdf:Alt>
                </dc:title>
                <dc:creator>
                    <rdf:Seq>
                        <rdf:li>hxxxdingens Consulting GmbH, Rodger Moore</rdf:li>
                    </rdf:Seq>
                </dc:creator>
                <dc:description>
                    <rdf:Alt>
                        <rdf:li xml:lang="de">Schrieb 2016-003 - Dings AG XXX R 7 99 3 - 2016-06-30 (2016:06:30)</rdf:li>
                    </rdf:Alt>
                </dc:description>
                <dc:date>
                    <rdf:Seq>
                        <rdf:li>2016:06:30</rdf:li>
                    </rdf:Seq>
                </dc:date>
            </rdf:Description>
        </rdf:RDF>
    </x:xmpmeta>
</fo:declarations>

然后输出将不符合:

$ java -jar ~/prog/hcbriefe/preflight-app-2.0.2.jar test_1.pdf
The file test_1.pdf is not valid, error(s) :
7.2 : Error on MetaData, Title present in the document catalog dictionary can't be found in XMP information (Property is not defined)
7.2 : Error on MetaData, Subject present in the document catalog dictionary can't be found in XMP information (Subject not found in XMP (dc:description["x-default"] not found))

但是当我调用exiftool在PDF上设置标题和描述时,它将通过此​​测试:

$ cp test_1.pdf test_1mod.pdf
$ exiftool -title="Schrieb 2016-003 - Dings AG" \
  -description="Schrieb 2016-003 - Dings AG XXX R 7 99 3 - 2016-06-30 (2016:06:30)" \
   test_1mod.pdf
    1 image files updated

$ java -jar ~/prog/hcbriefe/preflight-app-2.0.2.jar test_1mod.pdf
The file test_1mod.pdf is a valid PDF/A-1b file

我需要在元数据中添加什么才能使其符合开箱即用或直接符合FOP的要求?

1 个答案:

答案 0 :(得分:1)

经过一番比较,我发现了。说明和标题元素中的语言可能不会设置为de,但必须设置为x-default

      ...
      <dc:title>
          <rdf:Alt>
              <rdf:li xml:lang="x-default">Schrieb 2016-003 - Dings AG</rdf:li>
          </rdf:Alt>
      </dc:title>
      ...
      <dc:description>
          <rdf:Alt>
              <rdf:li xml:lang="x-default">Schrieb 2016-003 - Dings AG XXX R 7 99 3 - 2016-06-30 (2016:06:30)</rdf:li>
          </rdf:Alt>
      </dc:description>
      <dc:date>
<!-- some validators will complain if date has : instead of - !! -->
          <rdf:Seq>
              <rdf:li>2016-06-30</rdf:li>
          </rdf:Seq>
      </dc:date>
      ...

然后它将通过pdfbox预检测试。

此外,日期必须在y,m,d之间设置-个分隔符,以符合在线pdf-tools.com验证程序。