I needed a PHP version of my Ruby SOAP client for JaserpServer.
Here it is: http://gist.github.com/26205
Usage (this runs the report unit '/my_report' and returns the result in PDF format):
$jasper_url = "http://jasper.example.com/jasperserver/services/repository"; $jasper_username = "jasperadmin"; $jasper_password = "topsecret"; $client = new JasperClient($jasper_url, $jasper_username, $jasper_password); $report_unit = "/my_report"; $report_format = "PDF"; $report_params = array('foo' => 'bar', 'fruit' => 'apple'); $result = $client->requestReport($report_unit, $report_format,$report_params); header('Content-type: application/pdf'); echo $result;
13 comments:
You saved my time :) Can't wait to test it with my framework.
Do you have examples in other formats like xls,doc.
Thanks.
Should be the same, just change the $report_format from 'PDF' to 'XLS', 'DOC', or whatever. You'll also have to change the mime type from application/pdf to application/vnd.ms-excel for excel, application/vnd.ms-word for doc.
I tried to change $report_format to 'XLS', 'DOC', and the mime type from application/pdf to application/vnd.ms-excel for excel, application/vnd.ms-word for doc, But it didn't work.
Please help me ... Thanks.
I did it ... This page shows how to export a jasperreport to xls.
http://imrannazar.com/Parsing-the-DIME-Message-Format
I read the DIME document...but went over my head...can you show a more way of getting these into excel and word?
Hi,
I had problem i am using a server which doesnot support java and i am using firewalls that won't allow database from external servers, So even i am able to send the jasper report i should also give database access as the jasper file also included with sql queries, is there any method or plugin which can generate pdf using the data i sent along with report rather than database or can i generate a jasper report in such a way
pls. give us the code on which
new JasperClient() was called
$client = new JasperClient($jasper_url, $jasper_username, $jasper_password);
Do you have examples in other formats like xls,doc.
Thanks.
Is it possible to attach an XML dataset to report on?
how to include input control??
Hi!
I tried to get excel report with your code but i couldn't do it. how to get xls reports via php from jasperserver.
hello,
i have run your code and work fine,
now i need to know how can i change the connection info?
For example if i want work with other database or database server?
thaks for your help
Post a Comment