Jump to content
We've recently updated our Privacy Statement, available here ×

nelson.alves

Members
  • Posts

    3
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by nelson.alves

  1. Follow up at http://community.jaspersoft.com//questions/825900/how-sent-report-html-file-email-body-images
  2. Hello, You can embed the images when you export to html. Example: private static void exportToHTML(final JasperPrint jasperPrint, final OutputStream outputStream) throws JRException { final JRHtmlExporter exporter = new JRHtmlExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outputStream); exporter.setImageHandler(new HtmlResourceHandler() { private final Map<String, byte[]> imageMap = new HashMap<>(); @Override public void handleResource(final String id, final byte[] data) { //this method will be invoked by the jasper engine at filling time for each image and provide you a image key and the image content this.imageMap.put(id, data); } @Override public String getResourcePath(final String id) { //this method will be invoked by the jasper engine in order to get a value for the image property 'src'. So we can provide here the image content using the earlier key. return "data:image/x-png;base64," + Base64.encodeBase64String(this.imageMap.get(id)); } }); exporter.exportReport(); } Best regards Nelson
  3. Hello everybody! Recently I found a problem using the new subDataSource method regarding the characters encoding. This is happening when you run your application in a runtime environment where the default charset is not UTF-8, because inside the subDataSource method you should specify the charset UTF-8, UTF-16 or UTF-32, if you don't so, then it will be used the default one and as you know the UTF family is mandatory to the json parser library. I think this methods should be changed to something Like this: instead of new ByteArrayInputStream(currentJsonNode.toString().getBytes()) put this new ByteArrayInputStream(currentJsonNode.toString().getBytes("UTF-8")) Best regards, Nelson
×
×
  • Create New...