Merge two PDF's generated with jsPDF into one document

旧巷老猫 提交于 2020-04-16 04:49:49

问题


I'm using jsPDF for generation of document from HTML (with using .html() method) and it works fine. But now I need to do next:

  1. Create jsPDF object.
  2. Add content with using .html() method.
  3. Add new page to created document.
  4. Add content to second page with using the same .html() method.
  5. Save created document.

Here is the code example:

var doc = new jsPDF({ orientation: 'p', format: 'a4'  });
doc.html(document.getElementById('test'), {
   callback: function (doc) {
      doc.addPage('a4', 'p');
      doc.html(document.getElementById('test'), {
         callback: function (doc) {
            doc.output('dataurlnewwindow');
      }
   }
}

Problem is the second page is always blank. The idea is to create two separate documents with using .html() method and then merge this two document into one and save it.

So question is - is it possible in jsPDF to merge two documents into one and save it then?

Thanks in advance!

来源:https://stackoverflow.com/questions/56133670/merge-two-pdfs-generated-with-jspdf-into-one-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!