Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript Makepdf

Status
Not open for further replies.

Nyanja

Programmer
Jun 20, 2020
1
RW
I am able to export div content to pdf file but this is done when the content fit on one page. When there are more than one pages in the exported pdf file, all pages are empty. I am wondering how to export div content when pages many. My code is below:

<script type="text/javascript">
var name="END OF YEAR RANKS.pdf";
$("body").on("click", "#btnExport", function () {
html2canvas($('#tblCustomers')[0], {
onrendered: function (canvas) {
var data = canvas.toDataURL();
var docDefinition = {
content: [{
image: data,
width: 500
}]
};
pdfMake.createPdf(docDefinition).download(name);
}
});
});
</script>

This code is working for a div content that will be exported to only one page. When div content will be exported to many pages, how to do it? Help!
Also, how to add page numbers?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top