如何在 Apache FOP 中设置默认语言 [英] How to set the default language in Apache FOP

查看:31
本文介绍了如何在 Apache FOP 中设置默认语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Apache FOP 2.1 生成 PDF 文件.

I'm generating PDF files using Apache FOP 2.1.

为此,我试图将默认语言设置为英语.
这应该在通过 Adob​​e Reader 的选项文件/属性/高级/阅读选项创建 PDF 后进行验证.该值当前为空.

For this I am trying to set the default language to be English.
This is supposed to be verified after the creation of the PDF via Adobe Reader's option File/Properties/Advanced/Reading Options. This value currently is empty.

我尝试在 fo:root 元素、第一页序列或 的第一个元素中设置 xml:lang="en".xsl 文件...没有什么可以解决问题的.

I have tried setting xml:lang="en" in fo:root element, in first page-sequence or in the very first element of the .xsl file... Nothing seams to do the trick.

有什么建议吗?
谢谢迪米特里斯.

Any Advice?
Thanks Dimitris.

更新:
我已经按照答案中的建议尝试了另外 2 个选项,但 2 个都不起作用

Update:
I have tried 2 more options as suggested in the answers, neither of the 2 worked

  1. <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/‌extensions/pdf"><pdf:string key="Lang">en</pdf:string></pdf:catalog>
  2. <代码><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:描述 rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/"><dc:title>文档标题</dc:title><dc:language>en</dc:language>

更新 2
已经开始悬赏这个问题.
任何帮助表示赞赏和奖励

Update 2
Have started a bounty on this question.
Any help appreciated and rewarderd

推荐答案

根据我所尝试的一切,adobe reader 显示的文档属性中的语言字段与 pdf 中实际找到的文档语言没有太大关系(它总是空的).

According to everything I've tried, the Language field in the Document Properties shown by adobe reader has not much to do with the document language actually found in the pdf (It's alway empty).

带有 FOP 2.1 的 fo:root 中的 xml:lang="en" 标记足以让 exiftool 将文档列为具有英语语言,也足以让来自 pdfbox 的 PDFDebugger 显示文档目录中的/Lang 条目是根据 指定语言的地方pdf_reference 1.7 表3.25目录字典中的条目".

The xml:lang="en" tag in the fo:root with FOP 2.1 is sufficient for exiftool to list the document as having english language and also for the PDFDebugger from pdfbox to show the /Lang Entry in the Document catalog which is where the language is specified according to the pdf_reference 1.7 Table 3.25 "Entries in the catalog dictionary".

代码

<fo:declarations>
 <pdf:catalog 
   xmlns:pdf="http://xmlgraphics.apache.org/fop/‌extensions/pdf"‌​>
    <pdf:string key="Lang">en</pdf:string>
   </pdf:catalog>

在 pdf 输出中与 xml:lang 完全相同.

does exactly the same in the pdf output as the xml:lang.

此外,您还可以在元数据中设置语言(也在 fo:declarations 中)

Additonally you can also set the language in the metadata (also inside fo:declarations)

<x:xmpmeta 
  xmlns:x="adobe:ns:meta/" 
  xmlns:dc="http://purl.org/dc/elements/1.1/" 
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:RDF>
      <rdf:Description rdf:about="">
        <dc:language><rdf:Bag><rdf:li>en</rdf:li></rdf:Bag></dc:language>

但是如果 xml:lang 存在,我的 fop 2.1 似乎会自动设置.

But my fop 2.1 seems to set that too automagically if the xml:lang is there.

因此,如果有人能够解释 adobe reader 中的文档语言属性实际显示的内容,那将会很有趣.

So it would be interesting if someone drops in who can explain what that document language property in the adobe reader actually shows.

这篇关于如何在 Apache FOP 中设置默认语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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