问题描述
我正在使用飞碟 xhtmlrenderer 来构建 pdf 文档.到目前为止一切正常 - 现在我们应该在 pdf 中生成阿拉伯文本.Xhtmlrenderer 正在以相反的顺序呈现阿拉伯文本.
I'm using flying saucer xhtmlrenderer for building pdf documents. Everything worked fine until now - now we should generate arabic text inside pdf.Xhtmlrenderer is rendering Arabic text in reverse order.
我在互联网上的某个地方(可能是在他们自己的网站上)读到 xhtmlrenderer 不支持 bidi/rtl.但 IText 本身包含通过 ColumnText 和 PdfPTable 使用阿拉伯语和希伯来语的示例(来源可以在这里找到:http://sourceforge.net/projects/itextpdf/files/Examples/examples-155/examples-155.zip/download - arabic_hebrew.java),以及那些工作正常.
I've read somewhere on internet (maybe on their own site) that xhtmlrenderer does not support bidi/rtl.But IText itself contains examples to work with arabic and hebrew via ColumnText and PdfPTable (sources can be found here: http://sourceforge.net/projects/itextpdf/files/Examples/examples-155/examples-155.zip/download - arabic_hebrew.java), and those work fine.
我尝试在 xhtmlrenderer 的 ReplacedElementFactory/ITextReplacedElement 中使用 itext api,但找不到定位元素的好例子.有没有人尝试过这样做?或者也许有更简单(或至少有效)的解决方案?
I tried to use itext api in xhtmlrenderer's ReplacedElementFactory/ITextReplacedElement, but could not find good examples for positioning elements.Does anyone tried to do this? Or maybe there is a simplier (or at least working) solution?
推荐答案
最后,我可以使用飞碟在 rtl/ltr 中打印阿拉伯语文本.在我的代码中,我为每个阿拉伯文本块提供了宽度和对齐方式,但总的来说它工作正常.(已编辑)代码很大,无法在此处打印,请在 Google 群组中找到代码,链接在评论中.
Finally I'm able to print arabic text in rtl/ltr using flying saucer.In my code I'm giving width and alignment for every arabic text block, but in general it works fine.(Edited) Code is large to print it down here, please find the code on Google groups, the links are in the comments.
这篇关于FlyingSaucer LTR/RTL/BiDi 问题与阿拉伯文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!