小编she*_*ena的帖子

对于阿拉伯文本,RTL不能使用itext 5.5生成pdf

我有java代码在itext 5.5和xmlworker jars的帮助下编写阿拉伯字符,但是即使在使用writer.setRunDirection(PdfWriter.RUN_DIRECTION_RTL)之后它也是从左到右编写的.

使用的代码是:

public class CreateArabic extends DefaultHandler {
    /** Paths to and encodings of fonts we're going to use in this example */
    public static String[][] FONTS = {
        {"C:/arialuni.ttf", BaseFont.IDENTITY_H},
        {"C:/abserif4_5.ttf", BaseFont.IDENTITY_H},
        {"C:/damase.ttf", BaseFont.IDENTITY_H},
        {"C:/fsex2p00_public.ttf", BaseFont.IDENTITY_H}

    };



    /** Holds he fonts that can be used for the peace message. */
    public FontSelector fs;

     public CreateArabic() {
            fs = new FontSelector();
            for (int i = 0; i < FONTS.length; i++) {
                fs.addFont(FontFactory.getFont(FONTS[i][0], FONTS[i][1], BaseFont.EMBEDDED));
            }
        } …
Run Code Online (Sandbox Code Playgroud)

java arabic itext right-to-left xmlworker

3
推荐指数
1
解决办法
3285
查看次数

标签 统计

arabic ×1

itext ×1

java ×1

right-to-left ×1

xmlworker ×1