我正在使用以下代码在 iText 中生成希伯来语文本。
它工作得很好(创建一个希伯来字体,并使文本从右到左流动)但文本是左对齐而不是右对齐。
谁能帮我让它右对齐?请注意,我尝试使 MultiColumnText 右对齐,并使段落右对齐 - 但无济于事!
谢谢
static Color darkBlue = new Color(0x2F, 0x36, 0x99);
BaseFont unicode = BaseFont.createFont("c:/windows/fonts/arial.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
Font fontDarkBlueHebrew = new Font(unicode, 12, Font.NORMAL,darkBlue);
MultiColumnText mct=new MultiColumnText();
mct.addSimpleColumn(36, PageSize.A4.width()-36);
mct.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
mct.setAlignment(Element.ALIGN_RIGHT);
Paragraph section1a = new Paragraph("כותרת 1",fontDarkBlueHebrew );
section1a.setAlignment(Element.ALIGN_RIGHT);
mct.addElement(section1a);
Paragraph section1b = new Paragraph("הטקסט שלע",fontDarkBlueHebrew);
section1b.setAlignment(Element.ALIGN_RIGHT);
mct.addElement(section1b);
document.add(mct);