Search code examples
c#javascriptc#-2.0google-visualizationjsapi

How to use the image generated by Javascript at server side C#?


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.


Solution

  • 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.