如何在android中的iText pdf中编写bangla语言

时间:2017-04-26 09:49:18

标签: java android pdf

我在java中的itext pdf中使用了bangali语言,但它无法正常工作我的预期输出是:প্রযুক্তিশিল্পেরদ্রুত 但实际生成的输出是:output

这是我的代码

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);
            }

`

0 个答案:

没有答案