farwest

Members
  • Content count

    4
  • Joined

  • Last visited

Everything posted by farwest

  1. Hi, I met a problem with saving multiple charts to image and then generate a pdf with the images. I put each of the charts into one iframe, and then when the user clicks on the generate pdf button, a javascript function try to call another javascript function (saveChart) in each of iframe page. (please see the codes below) the problem is, it works fine with IE, but it doesn't work with firefox at all. I googled a lot and tried a lot diff things, but no luck with it. Anybody here get a idea what's wrong with it? Any input will be appreciated! Regards, Joe
  2. Hi, I met a problem with saving multiple charts to image and then generate a pdf with the images. I put each of the charts into one iframe, and then when the user clicks on the generate pdf button, a javascript function try to call another javascript function (saveChart) in each of iframe page. (please see the codes below) the problem is, it works fine with IE, but it doesn't work with firefox at all. I googled a lot and tried a lot diff things, but no luck with it. Anybody here get a idea what's wrong with it? Any input will be appreciated! Regards, Joe ------------------------------------------------------------------------------- main page < html> < head> < script language="JavaScript" type="text/javascript"> function saveCharts(){ top.iframe1.saveChart(); top.iframe2.saveChart(); top.iframe3.saveChart(); top.iframe4.saveChart(); top.iframe5.saveChart(); setTimeout('history.go(-1);', 9*1000 ); setTimeout('history.go(-1);', 9*1001 ); setTimeout('history.go(-1);', 9*1002 ); setTimeout('history.go(-1);', 9*1003 ); } < /script> < /head> < iframe name="iframe1" id="iframe1" src ="fusionChart1.jsp" width="470px" height="250px"> < /iframe> < iframe name="iframe2" id="iframe2" src ="fusionChart2.jsp" width="470px" height="250px"> < /iframe> < iframe name="iframe3" id="iframe3" src ="fusionChart3.jsp" width="470px" height="250px"> < /iframe> < iframe name="iframe4" id="iframe4" src ="fusionChart4.jsp" width="470px" height="250px"> < /iframe> < iframe name="iframe5" id="iframe5" src ="fusionChart5.jsp" width="470px" height="250px"> < /iframe> < a href="# " onclick="javascript:saveCharts();">DownLoad PDF< /a> < /form> < /body> < /html> ----------------------------------------------------------------------------------------------------- iframe page (fusionChart1.jsp ... fusionChart5.jsp) < html> < head> < script language="JavaScript" type="text/javascript" src="https://localhost:8443/bmw/js/FusionCharts.js"> < /script> < script language="JavaScript" type="text/javascript"> function saveChart(){ var chartToPrint; chartToPrint = getChartFromId('001'); chartToPrint.saveAsImage(); } < /script> < /head> < body bgcolor="#ffffff"> < form action="" method="post"> < object classid="01" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="420" height="190" id="001" > < param name="movie" value="../../charts/Scatter.swf" /> < param name="FlashVars" value="&registerWithJS=1&dataURL=../../charts/data_XYScatter.xml"> < param name="quality" value="high" /> < embed src="../../charts/Scatter.swf" flashVars="&registerWithJS=1&dataURL=../../charts/data_XYScatter.xml" quality="high" width="420" height="190" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> < /object> < /form> < /body> < /html>
  3. Hi Rahul, Thank you very much for the reply!! And the forgetting put the id in the embed tag is the reason for this. Best regards, Joe
  4. The history.go(-1), will re-render the chart in each of the iframe. The reason of using setTimeout() is to wait for the process of sending raw image data to server to be finished. Otherwise, the browser will go back to the previous page before the expected server response reaches client. Actually, the question is, in firefox, can we call saveAsImage() function for the chart in each iframe through a JavaScript function reside in the parent frame. Please see the attached image for a illustration. In the attached webpage, after the user clicks on "Download PDF", a javascript function in the parent frame will be triggered to call "saveAsImage()" for each of the charts starting from iframe1 to iframe5. At the server side, the program will cache the first 4 images and generate a pdf report after received the 5th image. and then send the pdf to client. It works fine with IE, but fails in firefox (tested on 1.5.x, 2.0.x, and 3.0.x) Thanks!