【问题标题】:PDF/A conforming metadata with FOP符合 FOP 的 PDF/A 元数据
【发布时间】:2016-07-08 14:00:48
【问题描述】:

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

假设我想设置日期、语言、标题和描述:

<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

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

【问题讨论】:

    标签: pdf metadata apache-fop pdfa


    【解决方案1】:

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

          ...
          <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 验证器。

    【讨论】:

    • 日期格式要求似乎很合理,因为YYYY-MM-DD 是日期的ISO extended format;我从未见过: 以日期格式使用(即使wikipedia 没有列出它)。
    • 对,我一直被 exiftool 写出来的方式所欺骗。优秀的工具,但并不意味着作为参考......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-25
    • 1970-01-01
    相关资源
    最近更新 更多