<!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> </head> <body> <center> <table class="table table-bordered" id="tabledata"> <tr> <th>slno</th> <th>name</th> </tr> <tr> <td>1</td> <td>Antony</td> </tr> <tr> <td>2</td> <td>Sophia</td> </tr> <tr> <td>3</td> <td>Angela</td> </tr> </table> </center> <center> <button class="btn btn-sucess" onClick="downloadDoc()">Download PDF</button> </center> <script type="text/javascript" src="lib/jquery.min.js"></script> <script type="text/javascript" src="lib/jspdf.debug.js"></script> <script type="text/javascript" src="lib/html2canvas.js"></script> <script type="text/javascript"> function downloadDoc(){ html2canvas($("#tabledata")[0],{ onrendered:function(canvas){ var data=canvas.toDataURL(); var docDefinition={ content:[{ image:date, width=500 }] }; pdfMake.CreatePdf(DocDefinition).download("Table.pdf"); } }) } </script> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)