我在用iReport生成pdf文件的时候碰见了如下问题:主要是参数显示不出来
 
  Exporting PDF (using iText) to file... C:\Users\gubin\Desktop\指导教师对博士学位论文的学术评语.pdf!
Error exporting print... UniGB-UCS2-H 
ExceptionConverter: java.io.UnsupportedEncodingException: UniGB-UCS2-H      at java.lang.StringCoding.encode(StringCoding.java:269)      at java.lang.String.getBytes(String.java:947)      at com.lowagie.text.pdf.PdfEncodings.convertToBytes(Unknown Source)      at com.lowagie.text.pdf.TrueTypeFont.<init>(Unknown Source)      at com.lowagie.text.pdf.TrueTypeFont.<init>(Unknown Source)      at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)      at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)      at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:1829)      at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk
网上说是没加包,但是我已配置上去 iTextAsian.jar
Styles设置也没问题有的加入简单Style的也能显示出来参数。配置复杂参数的就会报如上错误。。
求解

解决方案 »

  1.   

    补充一下,预览能出来值,但是生成pdf时会报错,但是整个页面依然会在pdf文件上显示出来,只是值没有
      

  2.   

    再加载groovy-all-1.5.5.jar和iText-2.1.0.jar两个jar包试试
      

  3.   

    谢谢。。解决了。。不过不是jar包的事
    呵呵!我在对$P{}绑定Style的时候,中间删了一次$P{},然后又加上了,只不过加上之后出现异常也就是上面所提到的我重新写了页面才好使的。也就是说$P{}绑定Style之后不能删了在创建$P{},否则转化成pdf文件时值转码会出现问题