FOP 2.1是否支持ViewerPreferences? [英] Does FOP 2.1 support ViewerPreferences?

查看:112
本文介绍了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.

我正在尝试(来自

但是得到

Jul 13, 2016 11:18:31 AM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Unknown formatting object "{http://xmlgraphics.apache/org/fop/extensions/pdf}dictionary" encountered (a child of fo:declarations}. (See position 242:105)
Jul 13, 2016 11:18:31 AM org.apache.fop.events.LoggingEventListener processEvent
WARNING: Unknown formatting object "{http://xmlgraphics.apache/org/fop/extensions/pdf}dictionary" encountered (a child of dictionary}. (See position 243:69)

并且pdf内没有ViewerPreferences.

and no ViewerPreferences inside the pdf.

当我将字典放在<x:xmpmeta xmlns:x="adobe:ns:meta/">下面时,我也没有看到ViewerPreferences,然后只有pdfbox preflight会抱怨

When I put the dictionarys below the <x:xmpmeta xmlns:x="adobe:ns:meta/"> then I get no ViewerPreferences either, only pdfbox preflight will then complain about

The file test.pdf is not valid, error(s) :
7.3 : Error on MetaData, Cannot find a definition for the namespace http://xmlgraphics.apache/org/fop/extensions/pdf

我在做什么错,我现在还为时过早尝试吗?我必须在哪里修补Fop?

What am I doing wrong, am I too early to try it? Where do I have to patch fop?

推荐答案

根据发行说明引入了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:arraypdf:booleanpdf:namepdf:numberpdf:string,...
    • there is no <pdf:dictionary type="Catalog">, there is pdf: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开发人员,尽管如今不是很活跃)

      这篇关于FOP 2.1是否支持ViewerPreferences?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆