FlyingSaucer LTR / RTL / BiDi问题与阿拉伯语文本 [英] FlyingSaucer LTR/RTL/BiDi issue with arabic text

查看:297
本文介绍了FlyingSaucer LTR / RTL / BiDi问题与阿拉伯语文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用飞碟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。这些工作正常。

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使用飞碟。
在我的代码中,我为每个阿拉伯语文本块提供宽度和对齐方式,但一般来说它工作正常。
代码很大,可以在这里打印,所以询问是否有人感兴趣

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. Code is large to print it down here, so ask if anyone is interested

这篇关于FlyingSaucer LTR / RTL / BiDi问题与阿拉伯语文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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