zoukankan      html  css  js  c++  java
  • 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,否则会出现异常

  • 相关阅读:
    django项目环境设置
    django模板中自动加载static
    linux更换shell外壳zsh
    MNIST数据集入门
    Xshell连接虚拟机突然被拒,提示再次输入密码。。。
    docker-ubuntu镜像,nginx镜像
    linux-ububtu64位安装docker,及基本命令
    linux-修改pip源
    centos 7怎么通过图形界面来配置静态ip
    centos7 真实机安装后没有网卡解决办法
  • 原文地址:https://www.cnblogs.com/laoyeye/p/6388983.html
Copyright © 2011-2022 走看看