Jspdf - 不能多次使用 .html() 方法

问题描述

当我尝试多次使用 html() 方法时,pdf 总是返回第一个文档内容

 exportPdf() {  
    const doc = new jsPDF('p','pt','a4');
    doc.html(document.getElementById("table1"),{x: 10,y: 250}).then(()=>{
        doc.addPage("a4","p");
        doc.setLineHeightFactor(2);
        doc.html(document.getElementById("table2"),y: 
          570}).then(()=>{ 
          doc.save('test.pdf');
        });
     });

  <div class="row" id="table1">
    <div class="col-12 my-2">  
      <p>Table1 paragraph</p>     
    </div>  
  </div>

 <div class="row" id="table2">
    <div class="col-6 my-2">  
      <p>Table1 paragraph</p>  
    </div>  
 </div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)