Jump to content
Changes to the Jaspersoft community edition download ×

Images not viewable on HTML reports


Recommended Posts


I am generating a HTML report in which an image is embedded. After the report is exported into HTML format and viewed on the browser, the image is not there, rather a cross appears. Further finding showed that Jasper renames the embedded images, similar to img_0_0_0 and stores in a map. Despite of enough research done, I'm not able to view the images.

I'm doing the following for the same:


CharArrayWriter charArrayWriter = new CharArrayWriter();

Map imagesMap = new HashMap();

JRHtmlExporter exporter = new JRHtmlExporter();

exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, "C:/reports/images");

exporter.setParameter(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);

exporter.setParameter(JRHtmlExporterParameter.OUTPUT_WRITER, charArrayWriter);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image=");

exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);


char[] content = charArrayWriter.toCharArray();

// html code generated




Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Thanks Lucian.


Just wanted to know if there's any way that I can control the naming of the images. I dont want Jasper to give it's own random names to the images that are embedded in the report. I want the names to remain the same as they were before getting exported.


That will really solve my purpose...

Link to comment
Share on other sites

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...