Jasper报告Pdf导出在Eclipse中,但是从Jar文件很慢 [英] Jasper Report Pdf Export in Eclipse ok but from Jar file very slow
问题描述
try {
Connection connection = null;
connection = dbConnect.dbConnector();
String year comboBox_1.getSelectedItem()。toString();
String items = textField_1.getText()。toString();
String amount = textField_2.getText()。toString();
Map parametersMap = new HashMap();
parametersMap.put(year,year);
parametersMap.put(items,items);
parametersMap.put(amount,amount);
String reportPath =C:\\Users\\Panagiotis\\workspace\\OceanBlue\\SalesReportYear.jrxml;
JasperReport jr = JasperCompileManager.compileReport(reportPath);
JasperPrint jp = JasperFillManager.fillReport(jr,parametersMap,connection);
JasperExportManager.exportReportToPdfFile(jp,C:\\\\\Panagiotis\\Desktop\\SaleReport+ textField_3.getText()+。pdf);
connection.close();
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}
解决方案.........在wero上面提到JDK之后,我检查了Windows,Eclipse和Jasper Reports Studio的JDK。对于Jasperreports来说是不同的。更正了它,现在pdf的出口时间平均为5秒。就那么简单。谢谢wero!
I am generating a Pdf report using Jasper Reports plugin in Eclipse. While working on the project in Eclipse the PDF creation time is approximately 5 seconds. When I export the project into an executable Jar file with the libraries packaged in the Jar the PDF creation time goes up to almost 3-4 minutes. Any ideas why that happens? Thanks in advance. If any other details should be provided please let me know. (Query returns 70 rows)
try{
Connection connection=null;
connection=dbConnect.dbConnector();
String year comboBox_1.getSelectedItem().toString();
String items = textField_1.getText().toString();
String amount = textField_2.getText().toString();
Map parametersMap = new HashMap();
parametersMap.put("year",year);
parametersMap.put("items",items);
parametersMap.put("amount",amount);
String reportPath = "C:\\Users\\Panagiotis\\workspace\\OceanBlue\\SalesReportYear.jrxml";
JasperReport jr = JasperCompileManager.compileReport(reportPath);
JasperPrint jp = JasperFillManager.fillReport(jr,parametersMap,connection);
JasperExportManager.exportReportToPdfFile(jp, "C:\\Users\\Panagiotis\\Desktop\\SaleReport"+textField_3.getText()+".pdf");
connection.close();
}
catch(Exception ex){
System.out.println(ex.getMessage());
}
}
So the solution.........after wero mentioning JDK above I checked the JDK of Windows, Eclipse and Jasper Reports Studio. It was different for the Jasperreports. Corrected it and now the exporting time of the pdf is 5 secs average. Simple as that. Thanks wero!
这篇关于Jasper报告Pdf导出在Eclipse中,但是从Jar文件很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!