JSPDF-多页 - 渲染HTML总是转到Page1
我们使用JSPDF 2.5.1渲染多页PDF。
我们使用HTML函数将各种DOM元素呈现到每个页面,并且在JSPDF的1.x版本中都可以使用,
但是现在每次我们调用.html()时,它将其放在首页上,而不是新添加的页面,这是代码
if (pdfPageIndex < numPdfPages) {
if (pdfPageIndex > 0) {
pdf.addPage();
}
pdf.html(
document.getElementById('pdfPage_' + pdfPageIndex),
{
html2canvas: {
logging: true
},
callback: function(){ return pdfCallback($scope)}});
We use jsPDF 2.5.1 to render a multi page PDF.
We use the html function to render various DOM elements to each page, and this was working in version 1.x of jsPDF
However now every time we call .html() - it puts it on the first page, rather than the newly added page, here is the code
if (pdfPageIndex < numPdfPages) {
if (pdfPageIndex > 0) {
pdf.addPage();
}
pdf.html(
document.getElementById('pdfPage_' + pdfPageIndex),
{
html2canvas: {
logging: true
},
callback: function(){ return pdfCallback($scope)}});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下基于帆布高度和宽度以下的附加模特方法,它将在多个页面中呈现
Please try with below addImage method based on canvas height and width it will render in multiple pages