Skip to content

Commit

Permalink
Merge pull request #764 from OneZoom/issue-463-screenshot-tool
Browse files Browse the repository at this point in the history
Resurrexct screenshot tool #463
  • Loading branch information
lentinj authored Mar 15, 2024
2 parents c0726b0 + 95f0807 commit 878f085
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions views/treeviewer/life_expert.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@
height: document.getElementById("OneZoomCanvasID").height,
});
onezoom.controller.draw_single_frame(context);
var svg_content = context.getSerializedSvg(true);
/* Change MIME type to trick the browser to download the file instead of displaying it */
lnk.href = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg_content);
lnk.href = URL.createObjectURL(new Blob([context.getSerializedSvg(true)], {
type: "image/svg+xml",
}));
lnk.download = 'onezoom.svg'; // Download file, instead of opening in browser
window.setTimeout(function () {
URL.revokeObjectURL(lnk.href);
}, 100);

return true;
} catch (err) {
alert("You can't save pictures with embedded images unless you enable '-allow-file-access-from-files' in chrome, or equivalent in other browsers.")
Expand Down

0 comments on commit 878f085

Please sign in to comment.