html2canvas and jdpdf is ignoring the svg images when i download
document.getElementById("download")
.addEventListener("click", () => {
HTMLCanvasElement.prototype.getContext = function(origFn) {
return function(type, attribs) {
attribs = attribs || {};
attribs.preserveDrawingBuffer = true;
return origFn.call(this, type, attribs);
};
}(HTMLCanvasElement.prototype.getContext);
const mapDownload = this.document.getElementById("mapDownload");
console.log(window);
var opt = {
margin: 1,
filename: 'myfile.pdf',
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2, useCORS: true, },
jsPDF: { unit: 'in', format: 'letter', orientation: 'landscape' }
};
html2pdf().from(mapDownload).set(opt).save();
})
Above is the snippet. I am i missing anything here to make that work ?