【问题标题】:PDF Accessibility | 'Title - Failed' Error in Acrobat Pro in PDF generated using XSL-FOPDF 辅助功能 |使用 XSL-FO 生成的 PDF 中的 Acrobat Pro 中出现“标题 - 失败”错误
【发布时间】:2019-08-09 08:10:44
【问题描述】:

我正在使用 Apache FO 从 XML 创建一个 PDF 文件。当我使用 Acrobat Reader Pro DC(版本 2019.010.20098)对生成的 PDF 运行可访问性检查时,可访问性报告显示“标题 - 失败”。

当我在 Acrobat 中查看文档的元数据时(文件 --> 属性 --> 描述选项卡),我可以看到标题、作者和主题值都填充了我的 FO 样式表中定义的值(见下文) .

如果我转到文件--> 属性--> 初始视图(选项卡)-->“窗口选项”(部分)并在显示中选择“文档标题”,然后重新运行可访问性检查标题是否通过。

此问题与this previous question 中提出的问题相同。

根据对上一个问题的回答,这个问题应该在 FOP 2.2 中得到解决。但是,我已经使用 FOP 2.2 和 FOP 2.3 进行了尝试,但问题仍然存在。我目前正在运行 FOP 2.3,在撰写本文时它是当前版本。

是否需要设置某些 FOP 值或属性以使 Acrobat 默认在初始视图中显示文档标题而不是文件名?

这是我的 XSL 的相关 sn-p:

            ...
            </fo:layout-master-set>

            <fo:declarations>
                <x:xmpmeta xmlns:x="adobe:ns:meta/">
                    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
                        <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
                            <dc:title>DOCUMENT TITLE</dc:title>
                            <dc:creator>COMPANY NAME</dc:creator>
                            <dc:description>DOCUMENT DESCRIPTION</dc:description>
                        </rdf:Description>
                    </rdf:RDF>
                </x:xmpmeta>
            </fo:declarations>

            <fo:bookmark-tree>
            ...

我错过了什么?

【问题讨论】:

  • 您生成的 PDF 版本是什么? PDF 1.4 的查看器首选项字典中添加了“DisplayDocTitle”。 (但是,如果您尝试制作可访问的 PDF,您似乎不太可能生成 PDF 1.3。)
  • 我正在生成 PDF 1.7。如何设置“DisplayDocTitle”值?
  • 其实我想我可能已经找到了我的答案here。

标签: pdf pdf-generation xsl-fo apache-fop


【解决方案1】:

我通过将以下 sn-p 添加到我的“fo:declaration”部分来解决此问题:

            <fo:declarations>
                <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
                    <!-- this will replace the window title from filename to below dc:title -->
                    <pdf:dictionary type="normal" key="ViewerPreferences">
                        <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
                    </pdf:dictionary>
                </pdf:catalog>
                <x:xmpmeta xmlns:x="adobe:ns:meta/">

我在this question了解了这种方法。

感谢@TonyGraham 的帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-22
    • 2010-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-15
    相关资源
    最近更新 更多