I am working on a web application and I have to convert a HTML page (have multiple tables and datatables) to PDF. I am using pdfmake
to convert the content of the page to PDF
.
This is the script I am using for it
<script type="text/javascript" >
var docDefinition = { content: "This is a sample PDF" };
alert("Will this work ");
pdfMake.createPdf(docDefinition).download('test.pdf');
</script>
Now, I want to convert full HTML page
to PDF
but I have na idea how to do this in pdfmake
.
In jsPDF there is something like this
<script>
function demoFromHTML() {
var pdf = new jsPDF('p','pt','a4');
pdf.addHTML(document.body,{pagesplit:true},function() {
pdf.save('Test.pdf');
});
document.getElementById('buttons').style.visibility = 'hidden';
}
</script>
i.e., document.body
to convert full web page to PDF. Is there any similar code available in pdfmake as well.
Is there any other way to convert whole web page to pdf apart from jsPdf and which uses javascript?