• ireport导出中英文pdf


    准备:

    报表开发工具:ireport 5.6.0

    报表框架: jasperreport5.6.0


    1、中文格式设置pdf fontname、isembedded、pdfencoding

    pdf fontname=STsong-light

    isembedded=true

    pdfencoding=Unigb-UCS2-H simplified

    注意字体必须是STSong-light,否则会出现异常,异常信息如下

    Error exporting print... Could not load the following font :  pdfFontName   : Helvetica pdfEncoding   : UniGB-UCS2-H isPdfEmbedded : true 
    net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font :  pdfFontName   : Helvetica pdfEncoding   : UniGB-UCS2-H isPdfEmbedded : true      at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.Java:2117)      at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1906)      at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1875)      at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:89)      at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:100)      at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2238)      at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:950)      at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:909)      at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:786)      at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:513)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:1174)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  Caused by: ExceptionConverter: java.io.UnsupportedEncodingException: UniGB-UCS2-H

    2、英文数字设置pdf fontname、isembedded、pdfencoding

    pdf fontname=default

    isembedded=true

    pdfencoding=CP1252

    注意字体不能设置成STSong-light,否则会出现异常

  • 相关阅读:
    数据库三级考试的随笔2.0
    数据库三级考试的随笔1.2
    数据库三级考试的随笔1.1
    数据库三级考试的随笔1.0
    陈贤文的第一次试水
    点分治总结
    Treap总结
    UML之二、建模元素(1)
    StarUML之九、starUML的一些特殊属性的说明
    UML之一、为什么需要UML?
  • 原文地址:https://www.cnblogs.com/laoyeye/p/6388983.html
Copyright © 2020-2023  润新知