Convert (Export) HTML Table to PDF file using JavaScript

  HTML & CSS

Email

Javascript using Excel and PDF exporting the using Javascript

You create the Two Button and apply the code this particular  code

<script type=’text/javascript’ charset=’utf-8′>

var value_pass = ” <?php echo “DueslistBR”.$br.”-“.date(“dmY”) ?> “;
$(document).on(‘click’,’.excel’,’pdf’,function(){
$(“#result_table th”).removeAttr(‘style’);

$(“#result_table”).table2excel({
exclude: “.noExl”,
name: value_pass
});

});

</script>
<script type=”text/javascript”>
function Export() {
html2canvas(document.getElementById(‘result_table’), {
onrendered: function (canvas) {
var data = canvas.toDataURL();
var docDefinition = {
content: [{
image: data,
width: 500
}] };
pdfMake.createPdf(docDefinition).download(“Table.pdf”);
}
});
}
</script>

Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of