【发布时间】:2025-12-25 01:40:11
【问题描述】:
我正在使用 itext 库创建 pdf,但我无法在 pdf 中打印卢比符号 我有字符串值来打印卢比符号
<string name="Rs">\u20B9</string>
我将数据添加到表中的代码如下
PdfPTable table1 = new PdfPTable(columnWidths);
table1.setWidthPercentage(100);
table1.getDefaultCell().setUseAscender(true);
PdfPCell cell;
cell = new PdfPCell(new Phrase((R.string.rs)+"2500",StaticValue.FONT_SUBTITLE));
cell.setFixedHeight(28);
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
table1.addCell(cell);
【问题讨论】:
-
试试
\u20B9 -
你是对的,只需将 R.string.rs 更改为 getResources().getString(R.string.Rs);
-
@jaimin 抱歉,它不起作用
-
₹ 然后使用它。 -
什么是
StaticValue.FONT_SUBTITLE?也许这个字体不包含那个符号,或者它有一个没有那个符号的编码......
标签: android pdf itext pdf-generation cell