Skip to content Skip to sidebar Skip to footer

Javascript Copy Canvas State As Image

Seen a good charts plugin I want to use: http://www.jqplot.com/tests/stackedTests.php But for my visitors, they may want to save this as an image (via right click, copy as image me

Solution 1:

I think toDataURL could help you :)

Solution 2:

If you are willing to use a pre-made library, you can try using Canvas2Image.

Otherwise there are a few Canvas methods that Canvas2Image wraps around and explain in more detail in the above site, namely the toDataURL method in the Canvas object that returns the data base64 encoded in the image format that you require. It's not 100% cross-browser, I think, but it's the "right" way of getting it.

Post a Comment for "Javascript Copy Canvas State As Image"