diff options
Diffstat (limited to 'upn.html')
-rw-r--r-- | upn.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/upn.html b/upn.html new file mode 100644 index 0000000..8d0aab3 --- /dev/null +++ b/upn.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"> + <title></title> +</head> +<body> +<div id="svg-container"> +<object type="image/svg+xml" data="upn.svg"></object> +</div> + +<canvas id="canvas" width="210mm" height="99mm"></canvas> +<div id="png-container"></div> + + +<script> +var svgString = new XMLSerializer().serializeToString(document.querySelector('svg')); + +var canvas = document.getElementById("canvas"); +var ctx = canvas.getContext("2d"); +var DOMURL = self.URL || self.webkitURL || self; +var img = new Image(); +var svg = new Blob([svgString], {type: "image/svg+xml;charset=utf-8"}); +var url = DOMURL.createObjectURL(svg); +img.onload = function() { + ctx.drawImage(img, 0, 0); + var png = canvas.toDataURL("image/png"); + document.querySelector('#png-container').innerHTML = '<img src="'+png+'"/>'; + DOMURL.revokeObjectURL(png); +}; +img.src = url; + +</script> + +</body> +</html>
\ No newline at end of file |