Closed lvsan closed 1 year ago
yes if no data provided it will try to draw nodataband. you may try to use 'array' for testing:
$config = [
'driver'=>'array',
'data'=>[
['user_id'=>0, 'fullname' => 'name1','email'=>'email1@a.com','gender'=>'M' ],
['user_id'=>1, 'fullname' => 'name2','email'=>'email2@a.com','gender'=>'F' ],
['user_id'=>2, 'fullname' => 'name3','email'=>'email3@a.com','gender'=>'M' ],
]
];
refer here too:
Hi,
i have remove the import value from the jrxml files. But when run, the report show me as below screen.
is there anyone know what this is meaning?
Hi,
Have found there is error when using driver for mysql. check there is error under below:
protected function connect(array $config) { $host = $config['host']; $user = $config['user']; $pass = $config['pass']; $name = $config['name'];
if(gettype($config['connection'])=='object') //----- error here
{
$cn = $config['connection'];
}
else
{
$cn = new mysqli($host, $user, $pass, $name);
}
return $cn;
}
so i modify the code from my site to if(isset($config['connection']) && gettype($config['connection'])=='object')
then it is working now. But does this is the issues that causing my reports not working?
I also need to connect the mysql with the portno which the port number is not default to be use from my site.
thanks.
First of all, I would like to check with you is it the examples in the repository work in your computer? I worry you have php version issue.
Next, regarding the screenshoot displayed "%PDF-1.7...", usually this happen when there is some area at your framework accidentally printed some extra text cause the pdf pattern broken, the browser thought it is not valid pdf and display as plain text.
regarding mysql connection issue, you tried define "server:port" in 1 variabled?
Hi kstan,
I am using php version 8.1.18 + apache 2.4.54 _ mysql 8.0.21. Does this version for the php is not compatible?
for the below issues i feedback already settle and fix. Thanks. "Next, regarding the screenshoot displayed "%PDF-1.7...", usually this happen when there is some area at your framework accidentally printed some extra text cause the pdf pattern broken, the browser thought it is not valid pdf and display as plain text."
regarding mysql connection issue, you tried define "server:port" in 1 variabled? i will try see either this can be work. this will be something like below :
'host'=>'localhost:3308',
$config = ['driver'=>'mysql', 'host'=>'localhost:3308', 'user'=>'root', 'pass'=>'', 'name'=>'testdb', 'data'=>$data];
hi kstan,
i able to connect to my db with the recommend define "server:port" in 1 variable.
thanks.
However, does is there anyway for me to visible the textfield from the reports? or i just amend from my site? I try to load the image dynamically, is there any advise?
thanks.
I not sure your problem, try change
$report->load_xml_file($reportName)
->setDataSource($config)
->export('Pdf','some/writetable/folder/filename.pdf');
instead?
Hi kstan,
is ok. I will check myself. Others issues is solve and the reports is running well. will need to fine tune something.
thanks.
HI,
I have migrate the phpjasperxml from version 1.1 to this new version. Therefore, would like to check does the data under the config must have data?
I will need to recreate my ireport for this migration?
Below is the code that I have use and change for print the reports.
$data=[];
$config = ['driver'=>'mysql', 'host'=>$server, 'user'=>$user, 'pass'=>$pass, 'name'=>$db, 'port'=>$port, 'data'=>$data];
$report = new PHPJasperXML(); $report->load_xml_file($reportName)
->setDataSource($config) ->export('Pdf');