Jump to content
  • Problem with images in HTML - bug in JRHtmlExporter?

    Assigned User teodord
    CategoryBug report

    Issue moved from:



    Consult original issue for any attachments.


    [ 1476234 ] Problem with images in HTML - bug in JRHtmlExporter?


    Submitted By: Rónán Fleetwood - rfleetwood

    Date Submitted: 2006-04-25 09:47

    Last Updated By: teodord - Comment added

    Date Last Updated: 2006-05-05 08:57

    Number of Comments: 3

    Number of Attachments: 1


    Assigned To: Nobody/Anonymous

    Priority: 5



    Problem with images in HTML - bug in JRHtmlExporter?


    JRHtmlExporter.exportReport() saves images (e.g. graph images) to the file system after it returns the HTML to the browser. This means the images don't appear in the

    browser intially - the user has to click refresh to make the images appear.


    A solution is to call the code that creates the image files before returning the response to the browser.


    The attachment contains a fix. A new method (extracted from exportReport()) called createImageFiles() gets called from exportReportToWriter() at the end of the method just before writer.flush() is called.






    Date: 2006-05-05 08:57

    Sender: teodordProject Admin

    Logged In: YES





    I don't know yet. Let's change this into a patch for the moment.


    Thank you,



    Date: 2006-04-27 01:29

    Sender: rfleetwood

    Logged In: YES



    Thanks Teodor - yes that's helpful. Shouldn't this fix go in anyway to fix the problem in the case where you would want to save the images to disk?




    Date: 2006-04-26 03:29

    Sender: teodordProject Admin

    Logged In: YES





    You don't have to save the images in files on disk, especially if we are talking about a Web application that delivers HTML reports on-the-fly.


    Please take a look at the supplied /demo/samples/webapp sample that comes with our project distribution and you'll see that we are actually deliverying images to the browser using a special ImageServlet that locates the images inside the in-memory JasperPrint object.


    I is just about correctly configuring the JRHtmlExporter and the ImageServlet.


    I hope this helps.



    Attached Files:


    JRHtmlExporter.java JRHtmlExporter

    Attachments: JRHtmlExporter.java

    User Feedback

    Recommended Comments




    This is a fix for problem that should not appear in normal situations. Also, it is not clear it fully solves the issue as browsers might still render HTML before the flush() is called on the writer.


    We are not going to do the change yet.


    Thank you,



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