javascript - HTML String in Html2Canvas -
how pass valid html string html2canvas?
e.g
var html = "<html><head></head><body><p>hi</p></body></html>
the way done on http://html2canvas.hertzen.com/screenshots.html
html2canvas great , it's poorly documented.
you can following
var iframe=document.createelement('iframe'); $('body').append($(iframe)); settimeout(function(){ var iframedoc=iframe.contentdocument||iframe.contentwindow.document; $('body',$(iframedoc)).html('<html><head></head><body><p>hi</p></body></html>'); html2canvas(iframedoc.body, { onrendered: function(canvas) { $('body',$(document)).append(canvas); $('body',$(document)).remove(iframe); } }); }, 10);
see whole code here :
Comments
Post a Comment