【问题标题】:Save russian text to pdf将俄语文本保存为 pdf
【发布时间】:2013-09-08 13:14:37
【问题描述】:

我尝试通过 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();

【问题讨论】:

  • 您确定您的 TIMES.TTF 字体有西里尔字符吗?

标签: java android pdf cyrillic


【解决方案1】:

您需要设置正确的编码。

This example 可能会帮助你。

【讨论】:

    猜你喜欢
    • 2014-04-26
    • 2013-10-03
    • 1970-01-01
    • 2013-08-03
    • 1970-01-01
    • 2021-03-29
    • 1970-01-01
    • 1970-01-01
    • 2010-11-26
    相关资源
    最近更新 更多