我正在尝试使用DynamicJasper生成报告,但是我收到以下错误:
net.sf.jasperreports.engine.util.JRFontNotFoundException:
Font 'Arial' is not available to the JVM.
Run Code Online (Sandbox Code Playgroud)
安装了msttcorefonts,但我猜JVM没有使用它的任何字体.
我正在使用Ubuntu 10.04.
我怎样才能解决这个问题?
在生成PDF时添加"Č"或"Ć"等字符时出现问题.我主要使用段落在我的PDF报告中插入一些静态文本.这是我使用的一些示例代码:
var document = new Document();
document.Open();
Paragraph p1 = new Paragraph("Testing of letters ?,?,Š,Ž,?", new Font(Font.FontFamily.HELVETICA, 10));
document.Add(p1);
Run Code Online (Sandbox Code Playgroud)
生成PDF文件时得到的输出如下所示:"测试字母,Š,Ž,Đ"
出于某种原因,iTextSharp似乎不会识别这些字母,例如"Č"和"Ć".
在书中我看到了例子:
BaseFont bf = BaseFont.createFont("KozMinPro-Regular", "Identity-V", BaseFont.NOT_EMBEDDED);
Font font = new Font(bf, 20);
VerticalText vt = new VerticalText(writer.getDirectContent()); vt.setVerticalLayout(390, 570, 540, 12, 30);
font = new Font(bf, 20);
vt.addText(new Phrase(convertCIDs("a"), font));
vt.go();
public String convertCIDs(String text) {
char cid[] = text.toCharArray();
for (int k = 0; k < cid.length; ++k) {
char c = cid[k];
if (c == '\n')
cid[k] = '\uff00';
else
cid[k] = (char) (c - ' ' + 8720);
}
return new String(cid);
}
Run Code Online (Sandbox Code Playgroud)
当我更改为:
BaseFont bf …Run Code Online (Sandbox Code Playgroud)