lundi 4 juillet 2016

jsPDF Big table, headers overlap in second page


I'm using jsPDF and svg_to_pdf to export both an SVG and a table to a PDF. This is my code: function svg_to_pdf(svg, callback) { console.log("svgtopdf.js"); svgAsDataUri(svg, {}, function(svg_uri) { var image = document.createElement('img'); image.src = svg_uri; image.onload = function() { var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); var doc = new jsPDF('portrait', 'pt', 'a4', true); var dataUrl; source = $('#datos_alumnos')[0]; specialElementHandlers = { '#bypassme' : function(element, renderer){ return true; } }; margins = { top: 40, bottom: 60, left: 40, width: 270 }; canvas.width = image.width; canvas.height = image.height; context.drawImage(image, 0, 0, image.width, image.height); dataUrl = canvas.toDataURL('image/jpeg'); doc.addImage(dataUrl, 'JPEG', 0, 0, 500, 263); doc.fromHTML( source, 40, 270, { 'width': 550, 'elementHandlers': specialElementHandlers }, function(dispose){ //doc.save('SVG.pdf'); } , margins); callback(doc); } }); } The result is a PDF with the image at the top and the table next. The problem comes when it enters the second page as the headers of the table overlap with the first row and it looks like this. http://i.imgur.com/vlfm4Fv.png Is it possible to remove the headers on the second page?

Aucun commentaire:

Enregistrer un commentaire