FOP 2.1是否支持ViewerPreferences?
我正在使用FOP 2.1,并尝试设置ViewerPreferences,例如DisplayDocTitle-> true.
I'm using FOP 2.1 and am trying to set ViewerPreferences, e.g. DisplayDocTitle -> true.
根据发行说明引入了FOP 2.0,
According to the release notes FOP 2.0 introduced, among other things, a
- 用于增强PDF
/Catalog
和/Page
词典的低级机制
- Low level mechanism to augment PDF
/Catalog
and/Page
dictionaries
但是在网站上没有很多使用它的例子.
but there are not many examples of its usage in the website.
查看测试用例包含在源代码发行版中,尤其是名为pdf-dictionary-extension_*.xml
的代码中,我能够将类似于您的代码的内容放在一起,它不会生成运行时异常;坦白地说,我对这个PDF功能还不够熟悉,无法说出输出是否确实达到了您要执行的操作:
Looking at the testcases included in the source distribution, in particular the ones named pdf-dictionary-extension_*.xml
, I was able to put together something similar to your code which does not generate run-time exceptions; admittedly, I'm not familiar enough with this PDF feature to say whether the output actually achieves what you are trying to do:
<fo:declarations>
<pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
<pdf:dictionary type="normal" key="ViewerPreferences">
<pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
</pdf:dictionary>
</pdf:catalog>
</fo:declarations>
- 没有
<pdf:dictionary type="Catalog">
,而是pdf:catalog
- 没有单个
<pdf:entry key="..." type="...">
元素,但是每种可能的输入类型都有一个特定的元素:pdf:array
,pdf:boolean
,pdf:name
,pdf:number
,pdf:string
,...
- there is no
<pdf:dictionary type="Catalog">
, there ispdf:catalog
instead - there is not a single
<pdf:entry key="..." type="...">
element, but there is a specific element for each possible entry type:pdf:array
,pdf:boolean
,pdf:name
,pdf:number
,pdf:string
, ...
(披露:我是一名FOP开发人员,尽管如今不是很活跃)