本文介绍了jspdf中的倍数图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试生成包含多个图像的pdfd文件,我可以将一个图像放入pdf文档,但是我不能添加多个图像,我认为我需要做一个循环,但是我不知道如何:S,有人可以帮助我构建代码并生成包含多张图片的pdf吗?,这是我的代码.
I'm trying to generate a pdfd file with multiples images, i can put one image in pdf document but i can't add more than one image, i think that i need do a loop but i don't know how :S, somebody can help me to structure my code and generate a pdf with multiple images?, this is my code..
function pruebaPDF(){
html2canvas($(".jspdf2"),{
onrendered: function(canvas){
var height = $(".jspdf1").height();
var data = canvas.toDataURL("image/png"),
doc = new jsPDF({
orientation:'p',
unit:'mm',
format:'letter'
});
doc.addImage(data, 'PNG', 10, 6, 185, height);
//doc.addPage();
doc.save('tqwe.pdf');
}
});
}
推荐答案
您可以为图像创建一个新变量并使用addImage()函数:
You can create a new variable for your image and use the addImage() function:
希望有帮助.
这篇关于jspdf中的倍数图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!