我在使用jspdf将svg元素渲染为pdf时遇到了麻烦。我使用插件 https://github.com/CBiX/svgToPdf.js/ 去做这个。
以下是我的代码
// I recommend to keep the svg visible as a preview
var tmp = document.getElementById("chartContainer");
var svgDoc = tmp.getElementsByTagName("svg")[0];
var pdf = new jsPDF('p', 'pt', 'a4');
svgElementToPdf(svgDoc, pdf, {
scale: 72 / 96, // this is the ratio of px to pt units
removeInvalid: false // this removes elements that could not be translated to pdf from the source svg
});
pdf.output('datauri'); // use output() to get the jsPDF buffer
它正在生成空白pdf。请帮忙