I need your help in display the Arabic content and to start the writing from right to left in the PDF sample that I am trying to create. Here is the sample code:
public static void main(String[] args) throws IOException {
try {
BaseFont ArialBase = BaseFont.createFont("C:\\Users\\dell\\Desktop\\arialbd.ttf", BaseFont.IDENTITY_H, true);
Font ArialFont = new Font(ArialBase, 20);
Document document = new Document(PageSize.LETTER);
PdfWriter.getInstance(document, new FileOutputStream("C:\\Users\\dell\\Desktop\\HelloWorld.pdf"));
document.setMargins(72f, 72f, 72f, 0f);
document.open();
document.add(new Paragraph("الموقع الإلكتروني,",ArialFont));
document.close();
System.out.println("PDF Completed");
} catch (DocumentException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
With the above code, the Arabic text will be shown as below:
الموقع الإلكتروني,
which is unidentified and the text is from left to right. So how can I solve this?