首页 > 代码库 > jasperreports+Ireport开发搭建

jasperreports+Ireport开发搭建

1.报表依赖

 <dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>6.0.0</version>
 </dependency>

2.异常

 org.codehaus.groovy.control.CompilationFailedException

解决方案:

    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <version>2.4.3</version>
    </dependency>

3.异常报错

    net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font : 
    pdfFontName   : STSong-Light
    pdfEncoding   : UniGB-UCS2-H
    isPdfEmbedded : true
        at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2152)
        at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1942)
        at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1911)
        at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:89)
        at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:99)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2275)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:985)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:944)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:816)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:519)
        at net.sf.jasperreports.engine.JasperExportManager.exportToPdfFile(JasperExportManager.java:157)
        at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfFile(JasperExportManager.java:505)
        at com.gs.ireport.service.ReportService.main(ReportService.java:64)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

解决方案:

     <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itext-asian</artifactId>
        <version>5.2.0</version>
    </dependency>

jasperreports+Ireport开发搭建