使用html2canvas将3个图像转换为画布,然后使用jsPDF转换为PDF。我的目标是将每个图像放在单页中。
在上一次图片转换成功后,我需要帮助将一个图像转换为画布。
html2canvas(clone, {
onrendered: function(canvasObj) {
//objs.push(canvasObj);
console.log("1")
startPrintProcess(1,canvasObj,pdf, pdfConf, 'printedPDF',function (){
//alert('PDF saved');
console.log("2")
offScreen = document.getElementById('svg1');
clone = hiddenClone(offScreen);
html2canvas(clone, {
onrendered: function(canvasObj) {
//objs.push(canvasObj);
console.log("1")
startPrintProcess(2,canvasObj,pdf, pdfConf, 'printedPDF',function (){
//alert('PDF saved');
console.log("2")
offScreen = document.getElementById('svg2');
clone = hiddenClone(offScreen);
html2canvas(clone, {
onrendered: function(canvasObj) {
//objs.push(canvasObj);
console.log("1")
startPrintProcess(3,canvasObj,pdf, pdfConf, 'printedPDF',function (){
//alert('PDF saved');
console.log("2")
pdf.save('fileName.pdf');
});
console.log("On Rendered!!");
}
});
});
console.log("On Rendered!!");
}
});
});
console.log("On Rendered!!");
}
});
基本上我想让上面的代码动态和递归。
提前致谢!