更改希伯来字母iText的书面文本方向 [英] Change direction of written text for Hebrew letters iText

查看:106
本文介绍了更改希伯来字母iText的书面文本方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在PDF上写希伯来字母时,它们从左到右显示.

When I write Hebrew letters on a PDF they appear from left to right.

如何更改方向?

我正在使用Paragraph.

推荐答案

看看这个示例:

Document document = new Document(PageSize.A4);
String filename = ""; // Set the relative path and name for the output file
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
// Fix the path to the font if needed
BaseFont bf = BaseFont.createFont("c:/windows/fonts/arial.ttf", BaseFont.IDENTITY_H, true);
Font font = new Font(bf, 14);
ColumnText column = new ColumnText(writer.getDirectContent());
column.setSimpleColumn(36, 770, 569, 36);
column.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
String text = "הטקסט שלך בעברית"; // Your text in hebrew
column.addElement(new Paragraph(text, font));
column.go();
document.close();

这篇关于更改希伯来字母iText的书面文本方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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