How to print the jasper report on console
request.getSession().setAttribute("IMAGES_MAP", imagesMap);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "" + request.getContextPath() + "//image?image=");
exporter.setParam开发者_JAVA百科eter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outStream);
After this I set the out to a iframe and it works fine.
Before sending the exported html page I want the html page to be printed in console because when the same report is viewed in pdf the colors come but the colors do not come in html format.
JasperExportManager.exportReportToHtmlFile method allows you to export the html to a file and you may use the Apache Commons FileUtils readFileToString(new File(destinationHtmlFile))
to get the contents of the file as a string which you may print on the console
精彩评论