|
Server IP : 127.0.0.1 / Your IP : 127.0.0.1 Web Server : Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3 System : Windows NT WIN-R7LTCC7BPLI 6.3 build 9200 (Windows Server 2012 R2 Datacenter Edition) i586 User : GerbangSIPAD ( 0) PHP Version : 5.6.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF Directory (0777) : C:/xampp5/tomcat/webapps/JavaBridge/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/*
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with This file. If not, see <http://www.gnu.org/licenses/>.
tsuyu
*/
require_once("http://127.0.0.1:9000/JavaBridge/java/Java.inc");
$fillManager = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
$params = new Java("java.util.HashMap");
$params->put("title", "Customer");
$class = new JavaClass("java.lang.Class");
$class->forName("org.postgresql.Driver");
$driverManager = new JavaClass("java.sql.DriverManager");
//db username and password
$conn = $driverManager->getConnection("jdbc:postgresql://192.168.11.80:5432/bhumie", "bhumie", "bhumie");
$jasperPrint = $fillManager->fillReport(realpath(".") . "\\" . "report2.jasper", $params, $conn);
$exporter = new java("net.sf.jasperreports.engine.JRExporter");
$outputPath = realpath(".") . "\\" . "output.txt";
try {
$exporter = new java("net.sf.jasperreports.engine.export.JRTextExporter");
$exporter->setParameter(java("net.sf.jasperreports.engine.export.JRTextExporterParameter")->PAGE_WIDTH, 120);
$exporter->setParameter(java("net.sf.jasperreports.engine.export.JRTextExporterParameter")->PAGE_HEIGHT, 60);
$exporter->setParameter(java("net.sf.jasperreports.engine.JRExporterParameter")->JASPER_PRINT, $jasperPrint);
$exporter->setParameter(java("net.sf.jasperreports.engine.JRExporterParameter")->OUTPUT_FILE_NAME, $outputPath);
} catch (JavaException $ex) {
echo $ex;
}
header("Content-type: text/plain");
$exporter->exportReport();
readfile($outputPath);
unlink($outputPath);
?>