You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rather than just taking an existing canvas and using drawImage to insert an image tag inside of an svg tag, I was expecting a direct translation of each node into a path or text or other valid svg options.
Is this something that is planned, rather than having to use the mock canvas?
The reason I ask is that I am currently prototyping html2canvas.js in an attempt to get a screenshot on the client-side to be persisted for auditing purposes. This does work, but I was wondering about a side-by-side comparison and svg would also give event options too.
Thanks
The text was updated successfully, but these errors were encountered:
You can't actually "transform" a canvas element that's has already been drawn to as it's just a bitmap. When you export to SVG you're really just calling the same drawing function again using a fake context. Suggested usage is to reuse the same drawing method, and you will get path, text and other elements, provided that your drawing function isn't just calling a bunch of drawImage commands:
//create a canvas2svg mock contextvarmyMockContext=newC2S(500,500);//pass in your desired SVG document width/heightvardraw=function(ctx){//do your normal drawingctx.fillRect(0,0,200,200);//etc...}draw(myMockContext);myMockContext.getSerializedSvg();//returns the serialized SVG documentmyMockContext.getSvg();//inline svg
Accurate screenshots of the webpage can be accomplished through other means:
Any other js client side implementation of a DOM renderer.
I'm not sure what you would get from exporting the canvas to svg in this case, as the html of the page and the serialization of the canvas (using canvas.toDataURL) to an image would be more interesting.
Rather than just taking an existing canvas and using drawImage to insert an image tag inside of an svg tag, I was expecting a direct translation of each node into a path or text or other valid svg options.
Is this something that is planned, rather than having to use the mock canvas?
The reason I ask is that I am currently prototyping html2canvas.js in an attempt to get a screenshot on the client-side to be persisted for auditing purposes. This does work, but I was wondering about a side-by-side comparison and svg would also give event options too.
Thanks
The text was updated successfully, but these errors were encountered: