Closed elidorio closed 6 months ago
What it show, beside it is pdf why you echo something?
Have you check sample report and is it work well in your computer?
phpjasper.zip Now, I managed to put together a report, the problem is in displaying the data, the script is not sending the sql assembled in the script to the report, but rather getting the sql from the report itself without any filter.
add ->setQueryString($sql)
before export('pdf')
It didn't solve it, the problem still persists.
according to code PHPJasperXML_load, the setQueryString()
execute within load_xml_file
/load_xml_string
.
Your execution ofsetQueryString()
by right will replace build in sql, just ensure it run after load_xml_file
/load_xml_string
.
If you still failed, you may debug within PHPJasperXML_load.php
in your vendor
close due to no feed back
I am unable to use the PHPJASPERXML class. I don't know what's wrong in my code! I'm using it with php, pdo and postgressql database.
<?php $server="localhost"; $db="projetox"; $user="postgres"; $pass="xxxx555"; $cndriver="psql"; $pgport=5432;
?>
<?php date_default_timezone_set('America/Sao_Paulo');
include_once 'config/setting.php'; //include_once 'PHPJasperXML/src/PHPJasperXML.php'; //include_once 'PHPJasperXML/vendor/composer';
require_once 'PHPJasperXML/vendor/autoload.php';
use simitsdk\phpjasperxml\PHPJasperXML;
$filename = 'rep/cadcidade.jasper'; file:///opt/lampp/htdocs/projetox/relcadcidade.php
$report = new PHPJasperXML();
try { $report->load_xml_file($filename) ->setParameter(['reporttitle' => 'Database Report With Driver : ' . $config['driver']]) ->setDataSource($config) ->export('Pdf');
} catch (\Exception $e) { echo 'Erro ao gerar relatório: ' . $e->getMessage(); } ?>