You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
983 B
40 lines
983 B
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<script src="/static/js/FileSaver.js"></script>
|
|
<style>
|
|
#save-svg{
|
|
position: fixed;
|
|
top: 0.5em;
|
|
right: 0.5em;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
{{ svg|safe }}
|
|
|
|
<button id="save-svg">> SVG</button>
|
|
<!-- <button>> HPGL</button> -->
|
|
|
|
<script>
|
|
let save_button = document.getElementById('save-svg');
|
|
|
|
save_button.addEventListener('click', function(){
|
|
//get svg element.
|
|
let svg = document.getElementsByTagName("svg")[0];
|
|
|
|
//get svg source.
|
|
let serializer = new XMLSerializer();
|
|
let source = serializer.serializeToString(svg);
|
|
|
|
let blob = new Blob([source], {type: "text/plain;charset=utf-8"});
|
|
saveAs(blob, 'cobbled-paths.svg');
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|