Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying HTML report on the fly using JasperReport API  RSS feed

 
Amit Parnerkar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have read the Webapp example in demo samples of JasperReport but still could not solve the problem.
I am displaying a simple HTML report on the fly using servlet and it is not getting displayed in proper format. When I run this without using servlet and export it as HTML file, I observed it creates an image in a directory called reportname.html_files/px (and my guess is that this image is not getting displayed when I generate HTML on the fly) I am using the code given below to display the HTML on the fly and any image it is using. Can somebody please help me in figuring out as why this is not working?? Any help is appreciated.


jPrint = JasperFillManager.fillReport(compiledInputStream, parameters, datasource);

response.setContentType("text/html");
PrintWriter out = response.getWriter();
JRExporter exporter = new JRHtmlExporter();
Map imagesMap = new HashMap();
request.getSession().setAttribute("IMAGES_MAP", imagesMap);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image=");

exporter.exportReport();

Thanks
 
Al Mc
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following should work,

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,Boolean.FALSE);
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!