diff options
author | Anton Šijanec <sijanecantonluka@gmail.com> | 2020-03-30 15:12:21 +0200 |
---|---|---|
committer | Anton Šijanec <sijanecantonluka@gmail.com> | 2020-03-30 15:12:21 +0200 |
commit | 49ff1d32a7e3569a46e2311beedd66a6bb0520e4 (patch) | |
tree | 05e8bb48ec29058d06a38d32045553a100e2fe55 /upn.html | |
download | upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.tar upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.tar.gz upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.tar.bz2 upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.tar.lz upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.tar.xz upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.tar.zst upn-49ff1d32a7e3569a46e2311beedd66a6bb0520e4.zip |
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 |