ibrahimjan Posted July 31, 2011 Share Posted July 31, 2011 Hi AllAny one out there knows a bit about HTML5 <canvas>, I am trying to convert an SVG file to canvas using the google Canvg library, then if I am lucky convert the canvas to jpg or png file.At the moment, I managed to convert the SVG file to canvas, but the struggle is the jpg/png. Please feel free to have a look at the live link to get a better understanding of what I want to do.<script type="text/javascript" src="/js/rgbcolor.js"></script><script type="text/javascript" src="/js/canvg-1.0.js"></script><canvas id="canvas" width="0px" height="0px"></canvas><script type="text/javascript">window.onload = function() {var canvas = canvg('canvas', '../gallery/svg/myfile45.svg');window.location = canvas.toDataURL("image/png");}</script> Live script http://www.jancodesign.com/svg_canvas.asp Link to comment Share on other sites More sharing options...
ibrahimjan Posted August 1, 2011 Author Share Posted August 1, 2011 Anyone got any ideas on how to do this, please any help is much appreciated. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 1, 2011 Share Posted August 1, 2011 There's a Javascript error on your page. I don't think the canvg function returns anything. The toDataURL function is defined on the canvas element, not the return value of canvg. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.