Open dssen opened 4 years ago
Hi @dssen please send your code so i can help
Hi @geekcom How you want me to send you the code.do you want me to post it in here or do i need to send it to you via email.
<?php
require_once __DIR__ . '/vendor/autoload.php';
$invoiceID = 5;
use PHPJasper\PHPJasper;
try{
$input = __DIR__ . '/Report/invoiceRepoet.jrxml';
$output = __DIR__ . '/Report';
$options = [
'format' => ['pdf'],
'params' => ['Parameter1' => $invoiceID ],
'db_connection' => [
'driver' => 'postgres', //mysql, ....
'username' => 'root',
'password' => '123456',
'host' => '127.0.0.1',
'database' => 'fairway',
'port' => '3308'
]
];
$jasper = new PHPJasper;
$x = $jasper->process(
$input,
$output,
$options
)->output();
print_r($x);
exit(1);//just to avoid getting error handler on your framework
// echo "<iframe src=\"Report/invoiceRepoet.pdf\" width=\"100%\" style=\"height:100%\"></iframe>";
}
catch(Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
@geekcom hello. i sent you my project using we-transfer.can you please check and let me know.because i have stuck in here for weeks now
I have used it and it worked fine without connecting MySQL and then i try to connect databse to generate reports i get error saying "Unable to load driver: org.postgresql.Driver"
first i tried using command line to find the error.below is the code i used.
jasperstarter process "C:\wamp64\www\myphp\web_app/Report/invoiceRepoet.jrxml" -o "C:\wamp64\www\myphp\web_app/Report" -f pdf -P Parameter1="5" -t postgres -u root -p 123456 -H localhost -n fairway --db-port 3308
then i get the above mentioned error.can someone please help me.