我在java中的itext pdf中使用了bangali语言,但它无法正常工作我的预期输出是:প্রযুক্তিশিল্পেরদ্রুত 但实际生成的输出是:
这是我的代码
try {
Document document = new Document();
String encoding = "Identity-H";
Font fontNormal = FontFactory.getFont(("c:/windows/fonts/arialuni.ttf"), encoding, BaseFont.EMBEDDED, 8, Font.NORMAL);
PdfWriter pdfWriter = PdfWriter.getInstance(document, new FileOutputStream("D:/lockman/mas.pdf"));
pdfWriter.setPageEvent(new PDFGenerator());
document.open();
document.add(header);
Chunk chunkBengali = new Chunk("প্রযুক্তি শিল্পের দ্রুত " + "\n", fontNormal);
PdfPTable table = new PdfPTable(2);
table.addCell("Locale");
table.addCell("Translated Text");
PdfPCell cellBengali = new PdfPCell(new Phrase(chunkBengali));
table.addCell(new PdfPCell(new Phrase(new Chunk("Bengali", fontNormal))));
table.addCell(cellBengali);
document.add(table);
document.add(footer);
document.close();
} catch (FileNotFoundException ex) {
Logger.getLogger(PDFGenerator.class.getName()).log(Level.SEVERE, null, ex);
} catch (DocumentException ex) {
Logger.getLogger(PDFGenerator.class.getName()).log(Level.SEVERE, null, ex);
}
`