Skip to content
Christoph Burgmer edited this page Oct 22, 2018 · 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/13/

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).then(function (renderResult) {
    context.drawImage(renderResult.image, 10, 25);
});

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

Clone this wiki locally