Jump to content
Changes to the Jaspersoft community edition download ×

HTML with image from DB and Directory


Recommended Posts

How to generate jasper report on HTML when one image loaded from database and for the other we give a image path

My code

ByteArrayOutputStream baos = new ByteArrayOutputStream();

exporter = new JRHtmlExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);

exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, strImageInputDirectory);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strImageOutputPath == null ? "." : strImageOutputPath);

exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE);

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

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



byte[] bdata = ((ByteArrayOutputStream) baos).toByteArray();

I am able to work this in PDF

(image from Database and another stored in the webserver) using

byte image[] =(byte[]) outData.get("image");

ByteArrayInputStream img = new ByteArrayInputStream(image);

hmimg.put("P_PARAMV3", img);

print = JasperFillManager.fillReport(reportFileName, hmimg, jrxmlds);

bdata= JasperExportManager.exportReportToPdf(print);


Can any one help pls

Post edited by: ameet.au, at: 2007/06/04 10:52

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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