小编Pri*_*ari的帖子

使用jspdf将Svg渲染为Pdf

我在使用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
Run Code Online (Sandbox Code Playgroud)

它正在生成空白pdf.请帮忙

svg jspdf

14
推荐指数
1
解决办法
1万
查看次数

是webpack模块加载器还是捆绑器?

我有点像webpack.我发现webpack的一些地方是bundler意味着它只是创建了bundle.js文件.在某些地方,我发现webpack也充当模块加载器.它正在加载导入或要求es5语法没有任何加载器.如果webpack解析导入并需要javascript语法,那么babel和babel loader需要什么?

webpack babeljs

0
推荐指数
1
解决办法
333
查看次数

标签 统计

babeljs ×1

jspdf ×1

svg ×1

webpack ×1