简体   繁体   中英

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.

您已经从画布上获取了图像,因此其余部分与此处相同: C#中的JPG至PDF转换器

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM