jasper报告-pdf不显示补充汉字。brelow是jasper xml代码段以及我的代码。
java.lang.ArrayIndexOutOfBoundsException:131540 com.lowagie.text.pdf.CJKFont.getWidth(未知来源)
jrXML snippet: <font pdfFontName="ARIALUNI.TTF" pdfEncoding="Identity-H" isPdfEmbedded="true"/>
<paragraph leftIndent="15" />
</textElement>
<textFieldExpression><![CDATA[$F{searchText}]]></textFieldExpression>
</textField>
代码:
class Tet1 {
public static void main(String[] args) throws UnsupportedEncodingException {
JasperReport jasperReport = null;
JasperPrint jasperPrint;
HashMap jasperParameter = new HashMap();
JasperVO jasperVO = new JasperVO();
List searchVOList = new ArrayList();
InputStream isb = null;
try {
String str = ""学部首和汉";
String path = "C:\\MYData\\jasperNew\\test\\test.jrxml";
jasperReport = JasperCompileManager.compileReport(path);
System.out.println(str);
searchVOList.add(jasperVO.generateExcelData(str));
JRDataSource searchDS = new JRBeanCollectionDataSource(searchVOList);
jasperParameter.put("searchDS", searchDS);
/*System.out.println("text = " + new String(Character.toChars("??"))); */
jasperPrint = JasperFillManager.fillReport(jasperReport,
jasperParameter, new JRBeanCollectionDataSource(
searchVOList));
//JasperExportManager.exportReportToXmlFile(jasperPrint, "C:\\MYData\\jasperNew\\4u\\MyPDF22.xml", true);
JasperExportManager.exportReportToPdfFile(jasperPrint, "C:\\MYData\\jasperNew\\4u\\MyPDF.pdf");
} catch (Exception e) {
e.printStackTrace();
}
}
}