I'm searching for tool (jQuery plugin maybe) which would allow me to transform DOM element to .svg and then export it. I checked and googled patiently but didn't find any.
The big picture is that I have multiple charts (generated via Highcharts) in one div and I want to export them as one file. I found answer: https://www.highcharts.com/docs/getting-started/frequently-asked-questions#export-multiple , but in my div I have also some html data I want to export with those charts.
If you want to just export a div you can use Blob to build a file and force the download on the user. I found this jsFiddle and modified it a little for youre case:
let saveData = (function () {
let a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, fileName) {
let blob = new Blob([data], {type: "plain/txt"}),
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
};
}());
var data = document.getElementById("export-content-wrapper").innerHtml,
fileName = "export.html";
saveData(data, fileName);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.