如何将 div 内容添加到 jspdf 中的新页面?我尝试使用 <br> 并创建了一个新页面,但我看不到内容。

 <div id="printArea">
    <div style="margin: 3px 430px;">First Page</div>
    <div>Place content to Second Page</div>
  </div>
            var doc = new jsPDF();
            var specialElementHandlers = {
                '#editor': function (element,renderer) {
                    return true;
                }
            };

            $('#wrapper_div').on("click", "#print", function () {
                doc.fromHTML($('#printArea').html(), 15, 15, {
                    'width': 170,'elementHandlers': specialElementHandlers
                });
                doc.output('datauri');
            });

谢谢! :)

最佳答案

用:
doc.addPage();
这将为您添加一个新页面,然后您可以添加您的内容。

或者如果您想根据内容的高度添加新页面,请检查此链接:jsPDF multi page PDF with HTML renderer

关于javascript - 如何将 div 内容添加到 jspdf 中的新页面?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35254465/

10-12 12:39
查看更多