Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Minimal example for rasterizeHTML.js
<!DOCTYPE html>
<html>
<head>
<title>rasterizeHTML.js example</title>
<script type="text/javascript" src="lib/htmlparser.js"></script> <!-- Needed for Chrome & Safari to work around buggy XMLSerializer -->
<script type="text/javascript" src="lib/cssParser.js"></script> <!-- Needed to embed backgroundImages -->
<script type="text/javascript" src="lib/URI.js"></script> <!-- Needed to calculate paths when embedding stuff -->
<script type="text/javascript" src="rasterizeHTML.js"></script>
</head>
<body>
<canvas id="canvas" width="400" height="200"></canvas>
<script type="text/javascript">
var canvas = document.getElementById("canvas");
rasterizeHTML.drawHTML('Some <span style="color: green">HTML</span> with an image <img src="someimg.png" />', canvas);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment