将俄语文本保存为pdf

时间:2013-09-08 13:14:38

标签: java android pdf cyrillic

我尝试通过http://code.google.com/p/droidtext/将文字保存为pdf。但我有保存俄语文本的问题。在创建的pdf中,我看到所有拉丁字母和符号。但我没看到俄语字母。如果写文字如:“dfыва-:”,在pdf中我看到:“df-:”。我使用有俄文字母的字体。如果有人有同样的问题,请帮忙。 代码:

Document doc = new Document();
PdfWriter.getInstance(doc, new FileOutputStream("/sdcard/test.pdf");
doc.open();
BaseFont times = baseFont.createFont("/sdcard/test/TIMES.TTF", BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
doc.add( new Paragraph("dfыва-:", new Font(times, 14) ) );
doc.close();

1 个答案:

答案 0 :(得分:0)

您需要设置正确的编码。

This example可能会帮助你。