I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
Please use the “preformatted text” tool in the editor (</>) to add backticks around text.
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!