Skip to content
cburgmer edited this page Oct 14, 2012 · 8 revisions

Simply drawing some HTML

var canvas = document.getElementById("canvas"),
    html = "<span>Some HTML</span>";

rasterizeHTML.drawHTML(html, canvas);

Demo: http://jsfiddle.net/cburgmer/E8fb2/

Putting the HTML on the canvas ourselves

var canvas = document.getElementById("canvas"),
    context = canvas.getContext('2d'),
    html = "<span>Some more HTML</span>";

rasterizeHTML.drawHTML(html, function (image) {
    context.drawImage(image, 10, 25);
});

Demo: http://jsfiddle.net/cburgmer/NfE3c/4/

Clone this wiki locally