Jump to content

Show an html report without creating the file (with php java bridge)


cnaranjo

Recommended Posts

Hi, I need to show reports on a php site, so I installed php java bridge and it works fine when I create the reports with exportReportToHtmlFile to a directory, the problem is that the php site Im using, works on a way that changes all the path's to files or images, even the ones inside the code of an html, thats why I want to show it direct on the php that compile the report, is there a way todo that? I find a lot of info about generate it on pdf (and I think that can solve my problem) but for this proyect is not an option, it must be on html.

Here is my code:

$jcm = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
$report = $jcm->compileReport($dirJRXML.$informe.".jrxml");
$objClass = new JavaClass("java.lang.Class");
$objClass->forName('com.mysql.jdbc.Driver');

$objDbm = new Java("java.sql.DriverManager"); 
$objDbConnect = $objDbm->getConnection("jdbc:mysql://localhost:3306/db", "usr", "pass");

$params = new Java("java.util.HashMap"); 
    
$jfm = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
$print = $jfm->fillReport($report,$params,$objDbConnect);

$jem = new JavaClass("net.sf.jasperreports.engine.JasperExportManager");
$jem->exportReportToHtmlFile($print,$dirHTML.$informe.".html");

header('Location: html/'.$informe);

 

This create the file on a local folder and then I just redirect to it, like I say its working fine, it create the html file and the report data its fine, but when I redirect to it, the application on wish Im runing this, search for the images (a pixel that jr is puting inside to fill blank spaces) on a path thats not the one JR is placing the image.

I cant change the way the application works, so I need to show the report in other way, thats why I want to know if there is a way to not create the file and instead show the report direct on the code or something like that

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...