Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Differences when exporting chart with custom method vs exportContent

    Hello,

    We are trying to implement functionality in our application to use a headless browser to generate charts which can be emailed to users. I followed your suggestions in your server side docs for getPdfRenderer(). Below is the relevant code returning a byteArrayOutputStream that we can then insert into our Database and email out on a schedule.

    However, the resulting PDF is very blurry compared to the PDF produced using your native exportContent method. Do you have any idea why? I've attached two images showing the difference.


    Code:
    		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    		Map<String,String> settings = new HashMap<String,String>();
            settings.put("skinName", exportData.get("skinName").toString());
    		
    		PdfExport export = new PdfExport();
            ITextRenderer renderer = export.getPdfRenderer(exportData.get("chartHTML").toString(),settings);
            renderer.createPDF(byteArrayOutputStream);
    
    		return byteArrayOutputStream.toByteArray();
    Attached Files

    #2
    Disregard! I figured it out. I noticed you are using hiddenFrame transport in your exportContent call. So, I switched my call to use hiddenFrame and the chart is rendering correctly now. Possibly something you should specify in your docs for getPDFRenderer to avoid future confusion.

    Comment


      #3
      That wouldn't have an effect on quality. The same bytes are transferred.

      What might have an effect on quality is using either older versions of Batik libraries on your server, or if your headless browser is a very old version of the browser.

      Or, perhaps you just changed which PDF viewer you were using.

      Anyway, one of the above issues was likely resolved as a side effect of switching to HiddenFrame.

      Comment


        #4
        Thanks for the reply. This was all tested on my machine with the latest Chrome browser. And, we are using the latest versions of Batik. All I changed was hiddenFrame transport and made the same exact request again and it was cleaned up. But, since it is now working for me, I'm happy to leave it as a mystery.

        Comment

        Working...
        X