Need to Embed Dynamic URL to Image Control

Shasha
edited February 11, 2022 in Analytics #1
<p>Hi,</p>
<p> </p>
<p>I have an requirement of displaying image received from highcharts export server into BIRT report. Now I can get the same in HTML/viewer but not in pdf. Please find the sample report attached.</p>
<p>Anyway I can pass the url received in response to image control as URI?</p>
<p> </p>
<p>Regards</p>
<p>Shashank</p>

Comments

  • <p>You will run into a few hurdles with the current methodology.  HighCharts will export the chart at render time on the client side.  However, the BIRT image report item definition's source location occurs at design/runtime.</p>
    <p> </p>
    <p>Also, you chose SVG as HighChart's output which is not supported in the BIRT Image report item.  You can read about SVGs here (<a data-ipb='nomediaparse' href='http://developer.actuate.com/community/forum/index.php?/topic/38997-svg-image/?p=142767'>http://developer.actuate.com/community/forum/index.php?/topic/38997-svg-image/?p=142767</a>), here <a>(http://developer.actuate.com/community/forum/index.php?/topic/39296-svg-image-in-birt-report/)</a&gt; and here <a>(http://developer.actuate.com/community/forum/index.php?/topic/28757-adding-an-svg-image-steam-from-a-database-to-a-report/).</a&gt; </p>
    <p> </p>
    <p>So a possible solution is the combination of:</p>
    <p> </p>
    <p>1.  Changing the export output of HighCharts from SVG to PNG, a format that the BIRT Image report item supports</p>
    <p> </p>
    <p>2.  Using a separate report with a parameter that accepts the URL of the image generated from HighCharts export and use that as the URI for the BIRT Image report item.  Then you can export this to PDF.</p>
    <p> </p>
    <p>3.  Having a standalone HighCharts Export Server because the public one you are using will not serve up images to external applications.  Yes, it will export within the browser, but try opening the exported PNG or SVG in a different browser in incognito/private mode.  You'll get a 500, or Oops error.  The image in Step 2 cannot be access if a public HighCharts Export Server is used.</p>
    <p> </p>
    <p>You should review the Terms of Service for using the HighCharts Export Server (<a data-ipb='nomediaparse' href='http://www.highcharts.com/docs/export-module/terms'>http://www.highcharts.com/docs/export-module/terms</a>) before proceeding.  </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p>Now, as an alternative to what you are trying to implement, is to use commercial BIRT.  The HTML5 Charts in commercial BIRT are HighCharts based, and can be exported to PDF, and in Excel, a native Excel Chart item, not just a static image.</p>
    Warning No formatter is installed for the format ipb
  • <p>Thanks for the reply Clement.</p>
    <p> </p>
    <p>I already have Steps #1 & #3 in place. We are having our own highchart server which is giving us the URL of the image. As it is hosted within our firewall network I gave this public highchart server. Now only problem is I am unable to perform this step. "<span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Using a separate report with a parameter that accepts the URL of the image generated from HighCharts export and use that as the URI for the BIRT Image report item."</span></p>
    <p> </p>
    <p><span>I am unable to assign the URL received from highchart server to either report parameter or report level/page level variable. I also tried with declaring global-variable but that is also not working. Can you please give me a sample code for the same where I can use URL generated from highchart for png image generation?</span></p>
    <p> </p>
    <p><span>regards</span></p>
    <p><span>Shashank</span></p>
  • <p>Actually, it could be the same report, just use a parameter to toggle whether you hide or show image depending in your format of PDF or HTML via Visibility rules.  You'll have an HTML text report item for HTML and a Image report item for PDF/other formats except HTML.</p>
    <p> </p>
    <p>I'm unable to create a sample right now.  The only caveat I see here is if the HighCharts Export Server, whether public or private, only allows access of the exported image from the client side.  I am not sure because I don't have a HighCharts Export Server available to test.  hen you generate the PDF, the image request will come from your application server, or Java app, depending on how you deployed BIRT.  And this is a separate 'client' trying to access that exported URL from client #1 (your browser), may not have permissions.</p>
    <p> </p>
    <p>For the PDF image, you'll need to use client side JavaScript to pull the exported URL, and then build a URL to submit and re-execute the report again with the same parameters.  The URL to re-submit can be extracted from the JavaScript variable window.location.href, and at the minimum replace "__format=html" with "__format=pdf".</p>
    <p> </p>
    <p>You'll need to also wire up the parameters submitted to the original report.  You'll need to look in $('iframe#parameterDialogiframe') for all <input> with class BirtViewer_parameter_dialog_Input, and get the parameter names and values.</p>
    <p> </p>
    <p>So you're not table able to use commercial BIRT?</p>
    Warning No formatter is installed for the format ipb