PHP通过PHP/JAVA Bridge调用JasperReport报表(4)
93
94 $params = new Java("java.util.HashMap");
95 $params->put("text", "This is a test string");
96 $params->put("number", 3.00);
97 $params->put("date", convertValue("2007-12-31 0:0:0", "java.sql.Timestamp"));
98
99 $emptyDataSource = new Java("net.sf.jasperreports.engine.JREmptyDataSource");
100 $jasperPrint = $fillManager->fillReport($report, $params, $emptyDataSource);
101
102 $outputPath = realpath(".")."/"."output.pdf";
103
104 $exportManager = new JavaClass("net.sf.jasperreports.engine.JasperExportManager");
105 $exportManager->exportReportToPdfFile($jasperPrint, $outputPath);
106
107 header("Content-type: application/pdf");
108 readfile($outputPath);
109
110 unlink($outputPath);
111
112 ?>
5、访问PHP站点,http://www.2cto.com :8080/ireport.php,就可以输出PDF文档。
摘自 有所为,有所不为
相关新闻>>
- 发表评论
-
- 最新评论 更多>>