Jspdf is forcing my pdf to fit in one page, so I can't see anything in my pdf actually because there are a huge amount of data [ please have a look at jsfiddle : https://jsfiddle.net/frost000/04qt7gsm/21/ ]
var pdf = new jsPDF('p', 'pt', 'a4');
var btn = document.getElementById("btn");
btn.addEventListener('click', function() {
pdf.addHTML(document.body, function() {
pdf.save('test.pdf');
});
});
.card-header {
height: 8vh;
background-color: #0062cc;
color: white;
}
.card-header i {
margin-left: 26rem;
}
.card-footer {
height: 8vh;
}
.table td,
.table th {
padding: 0.2rem;
vertical-align: top;
border: 1px solid black;
}
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.4.0/jspdf.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<button id="btn">Click</button>
<table id="zoneTable" class="table table-hover table-bordered">
<thead>
<tr>
<th scope="col">SL#</th>
<th scope="col">Zone-Code</th>
<th scope="col">Zone Name</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
<tr>
<th scope="row">1</th>
<td style="text-align: center;">1</td>
<td>this is a cool zone</td>
</tr>
</tbody>
</table>
[ you can download pdf if you use from jsfiddle, but you can't download pdf from SO snippet]
Look this is not even my actual data, which is a huge amount.
So how can I display large amount of data to my pdf using JsPDF? please help me
[ and someone please tell me why pdf.addHTML
is fine in javascript but not usuable in typescript? (i did all npm installed) ]