How can I add div content to a new page in jspdf? I tried to use <br>
and it creates a new page but I can't see the contents.
<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');
});
Thank you! :)
How can I add div content to a new page in jspdf? I tried to use <br>
and it creates a new page but I can't see the contents.
<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');
});
Thank you! :)
Share Improve this question edited Feb 7, 2016 at 14:11 dontknow asked Feb 7, 2016 at 14:06 dontknowdontknow 891 gold badge1 silver badge10 bronze badges1 Answer
Reset to default 4Use:
doc.addPage();
This will add a new page for you and after that you can add your content.
or if you want to add new page depending on content's height check this link : jsPDF multi page PDF with HTML renderer