1. When IREPORT generates a Chinese PDF report, set: 1) Add ITEXT Chinese package in the lib directory 2) PDF Encoding Select unigb-ucs2-h (Chinese Simplified) PDF Font Name STSONG-Light (you can use View-> Report FONTS One Solved) 2. Ireport sometimes displays the solution in the database: 1) Element: Setting: Print When Details overflow; stretch overflow 2) Field is not enough
3. Dori.jasper.Engine.jrexception: Error Loading Object from File: D: /jakarta-tomcat-4.0.1/jakarta-tomcat-4.0.1/webapps/safe/safe1.jasper
The version of the new JasperReport is 0.5.2, Ireport is 0.5.0, you will change your search path in your search path.
4. A period of test code: package test;
/ ** *
Title: p> *
description: p> *
Copyright: Copyright (C) 2003 p> *
Company: EST p> * @Author mgp * @version 1.0 * / import dori.jasper.Engine. *; import dori.jasper.Engine.Util. *; import java.sql. *; import java.util. *; import dori.jasper.Engine. JasperReport; import java.util.Date; import java.text.SimpleDateFormat; public class report {public report () {} public static void main (String [] args) {JRResultSetDataSource = null jrds; JasperPrint jasperPrint = null; Map reportParams = new HashMap (); ResultSet rs = null; Connection con = null; Statement stmt = null; String sql = "select * from wms_sku"; String driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc: oracle : th: @ 192.168.0.254: 1521: Server1 "; try {jasperreport jasperreport = (jasperreport) JRLOADER.LOADOBJECT (" c :/est/helix/Helix/reports/testdao.jasper "); class.forname (driver); Con = D RiverManager.getConnection (URL, "****", "****"); stmt = con.createstatement (); rs = stmt.executeQuery (SQL); if (! rs.next ()) Return; JRDS = New JrResultSetDataSource (RS); JasperPrint = JasperfillManager.FillReport (JRDS); JRDS, JRDS, JASPRINTMANAGER.PRINTREPORTTOPDFFILE (JasperPrint, "C: /Abcd.pdf");
} Catch (classnotfoundexception ex) {ex.printstacktrace ();} catch (sqlexception EX) {EX.PrintStackTrace ();} catch (jrexception e) {E.PrintStackTrace ();}}} 5. Using the MySQL database to generate PDF Report, displayed in Tomcat: <% @ Page Import = "Dori.jasper.Engine. *"%> <% @ Page import = "java.util. *"%> <% @ Page import = "java.io. * "%> <% @ Page import =" java.sql. * "%> <% File reportfile = new file (Application.getRealPath (" / reports / mydoc5.jasper "); map parameters = new hashmap (); . Class.forName ( "org.gjt.mm.mysql.Driver") newInstance (); String url = "jdbc:? mysql: // localhost / clients user = sa & password = & useUnicode = true & characterEncoding = GB2312"; Connection conn = DriverManager .getConnection (url); byte [] bytes = JasperRunManager.runReportToPdf (reportFile.getPath (), parameters, conn); response.setContentType ( "application / pdf"); response.setContentLength (bytes.length); ServletOutputStream ouputStream = response .getOutputStream (); OUPU TSTream.write (bytes, 0, bytes.length); OuputStream.flush (); OuputStream.close ();%> Note: 1) <% @ Page ContentType = Text / HTML; Charset = GB2312 "%> This sentence No, otherwise I will be prompted 2) Get Chinese data encoding = GB2312 from the database 3) Since Ireport is inconsistent with the version of JasperReport released with JasperReport, there is a lot of errors, for example: Dori.jasper.Engine .Jrexception: Error Loading Object from file: d: /jakarta-tomcat-4.0.1/jakarta-tomcat-4.0.1/webapps/safe/safe1.jasper