0

I am following this tutorial. http://www.battlehorse.net/page/topics/charts/save_google_charts_as_image.html

This is the demo page. http://www.battlehorse.net/attach/topics/charts/google_charts_to_image.html

When we click on Convert to Image button, javascript convert the canvas to image. I want to use that pie chart to generate a PDF report which happens at server side.

Could you please advise the best solution for this? Thanks.

Jonas T
  • 2,989
  • 4
  • 32
  • 43
  • I don't know if that helps but on this page on the right upper corner of the chart you have 2 export options: http://www.highcharts.com/demo/ maybe you could look at those how they work – Rumplin Jul 04 '12 at 13:45

2 Answers2

0

You have already got the image from canvas so the rest is a duplicate of here: JPG to PDF Convertor in C#

Community
  • 1
  • 1
makeitmorehuman
  • 11,287
  • 3
  • 52
  • 76
  • converting image to PDF is not an issue. I'm already using the old version of google chart(image) on that report. The problem is how to get that image from server side, btnExport_Click event. The problem is Export function happens at server side before that javascript run at client side. – Jonas T Jul 04 '12 at 22:09
0

I found another way to do this.

I created SaveImage.aspx which accept form post data(Base64String(data:image/png;base64), and file name) and save the file.

On button click, I generate the google chart and send ajax post data(data:image/png;base64) to SaveImage.aspx and that page save the image. And then generate the PDF using that image.

Feel free to point out if you guys have a better solution.

Jonas T
  • 2,989
  • 4
  • 32
  • 43