I have a big scrollable table in the content body and i’m trying to save it as PDF
table
this is the code i’m using to save the pdf (i use this in other parts of the code for single page exports and it works fine)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js "></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
function export() {
const { jsPDF } = window.jspdf;
var doc = new jsPDF('l', 'mm', 'a4');
var elementHTML = document.getElementById('table_id');
doc.html(elementHTML, {
callback: function (doc) {
// Save the PDF
window.open(doc.output('bloburl')); // use this to debug
},
x: 5,
y: 10,
width: 290, //target width in the PDF document
windowWidth: 1150, //window width in CSS pixels
});
}
this is the pdf generated
pdf
As you can see it cuts the table and the second page is blank
I want to render the whole table. i zoomed out to let you see how many pieces are cut out in the export
full table
Hope someone can help me, Thank you
Emanuele Carluccio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.