Canvas to png and jpg


#1

how to save image to jpg
Is it possible to use function toDataURL ?
Error when using .toDataURL
this is what i try

var canvas = modeler.get('canvas')
var data = canvas.toDataURL(image/jpg)

I’m using react for frontend

I can use toDataURL with canvas html5
Thank you
Sorry for my english. Not my native language


#2

Please make yourself familiar with our toolkit. Canvas is not an instance of <canvas>. You can export a diagram as SVG using modeler.saveSVG. Afterwards, you can convert the SVG to JPG or PNG using canvg-browser or a similar library.


closed #3

This topic was automatically closed after 7 days. New replies are no longer allowed.