Sign in to follow this  
BV-EII

Print Using Javascript

Recommended Posts

I have a chart loading in a ModalPopup in an asp.net application. My client wants to have a button to print the chart instead of right clicking on chart to print it.

Is there way to access "Print It" menu using javascript. If yes then please share the code

Share this post


Link to post
Share on other sites

Thanks Angie for reply.

 

But I am not finding FusionCharts.printManager class in FusionChart.js. Its throwing error for me.

Please let me know if I have to download any new version of JS file to use this feature.

 

 

 

 

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

 

Please refer to the link below for more information:

 

http://www.fusioncha...intManager.html

 

Hope this helps!smile.gif

Share this post


Link to post
Share on other sites

Angie I downloaded the eval version got the latest script file. Now it could load the printManager class.

 

Now on button click in IE it working window.print(), printing everything on page and in firefox no chart. Any idea on this issue.

 

 

Thanks Angie for reply.

 

But I am not finding FusionCharts.printManager class in FusionChart.js. Its throwing error for me.

Please let me know if I have to download any new version of JS file to use this feature.

 

 

 

 

 

Share this post


Link to post
Share on other sites
Guest Angie

Hi,

 

Could you please send us a screenshot to look into the issue?

 

Awaiting for your reply.

Share this post


Link to post
Share on other sites

Hello Angie,

I am attaching 6 files.

1. TEST-IE-PAGE.JPG : This is how page looks on Internet explorer. Chart is loading on a ModalPopupExtender. I have print button which calling the javascipt as mentioned on link.

2. TEST-IE-Print.JPG : This is how it is getting printed from IE. Basically it is printing as we get from window.print (not just the chart). It is printing everything printable on the page along with the chart.

 

3. TEST-FIREFOX-PAGE.JPG : This is how page looks on Firefox .

4. TEST-Firefox-Print.JPG : This is how it is getting printed from Firefox. It prints everything on page but chart.

 

5. TEST-IE-RightClick-Print.JPG

6.TEST-Firefox-RightClick-Print.JPG

 

My requirement is to print just the chart not everything on the page as we can achieve using Right Clicking on chart. I have attached sample image 5 & 6 .

Thank you for your help. Hope you will help me find a solution.

 

 

 

 

Hi,

 

Could you please send us a screenshot to look into the issue?

 

Awaiting for your reply.

post-10551-073978600 1292618438_thumb.jpg

post-10551-095231700 1292618786_thumb.jpg

post-10551-025501800 1292618798_thumb.jpg

post-10551-027057900 1292618808_thumb.jpg

post-10551-042066300 1292618820_thumb.jpg

post-10551-087035900 1292618833_thumb.jpg

Share this post


Link to post
Share on other sites

Hi,

 

You would need to wait for a bit to let the print manager make the chart ready for print.

 

You can trap event when the print manager become ready.

 

This is a sample that shows how you can trap this event:

 

<html>
 <head>        
   <title>FusionCharts Print Manager</title>   
   <script type="text/javascript" src="FusionCharts/FusionCharts.js"></script>
 </head>   
 <body>     
   <div id="chartContainer">FusionCharts will load here!</div>          
   <script type="text/javascript"><!--         
     FusionCharts.printManager.enabled(true);

     var myChart = new FusionCharts( "FusionCharts/Column3D.swf", "myChartId", "400", "300", "0", "1" );
     myChart.setXMLUrl("Data.xml");
     myChart.render("chartContainer");

     FusionCharts.addEventListener ( 
         FusionChartsEvents.PrintReadyStateChange , 
         function (identifier, parameter) {
           if(parameter.ready){ 
              alert("Chart is now ready for printing.");
              document.getElementById('printButton').disabled = false;
           }
       });
   // --></script>        
   <input type="button" onclick="FusionCharts.printManager.managedPrint()"
       value="Managed Print" disabled="disabled" id="printButton" >
 </body> 
</html>

 

You can try this sample live from :http://www.fusioncharts.com/Code/JavaScript/Basics/ManagedPrintForMozilla/ManagedPrintingInMozillaBrowsers.html

 

And Documentation on :

 

http://www.fusioncharts.com/docs/?JavaScript/JS_PrintManager.html

Share this post


Link to post
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
Sign in to follow this