Here is Html Table Code:
<table id="tab_customers" class="table table-bordered table-striped hidden">
<thead>
<tr>
<th>Month</th>
<th>Total Income</th>
<th>Total Expenses</th>
<th>Total Profit</th>
<th>Total Loss</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php if(!empty($month_name)) { echo $month_name; } else { echo '-';}?></td>
<td><?php if(!empty($total_income)) { echo $total_income; } else { echo '0';}?></td>
<td><?php if(!empty($total_expenses)) { echo $total_expenses; } else { echo '0';}?></td>
<td><?php if(!empty($total_profit)) { echo $total_profit; } else { echo '0';}?></td>
<td><?php if(!empty($total_loss)) { echo $total_loss; } else { echo '0';}?></td>
</tr>
</tbody>
Script Code:
<script>
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
source = $('#tab_customers')[0];
specialElementHandlers = {
'#bypassme': function (element, renderer) {
return true
}
};
margins = {
top: 80,
bottom: 60,
left: 70,
width: 800
};
pdf.fromHTML(
source,
margins.left,
margins.top, {
'width': margins.width,
'elementHandlers': specialElementHandlers
},
function (dispose) {
pdf.save('Test.pdf');
}, margins);
}
This plugin is working fine but the issue is the html table design to PDF is not correct attach is the resulted picture of PDF.
I am new to use this plugin Please guide me about how to set table design in PDF.
Thanks to all for any help