Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $('#btnPDF').click(function() {
- savePDF(document.querySelector('#geraPDF'));
- });
- });
- function savePDF(codigoHTML) {
- html2canvas(document.getElementById("geraPDF"), {
- onrendered: function(canvas){
- var img = canvas.toDataURL('image/png', 'quality: 0.2');
- var doc = new jsPDF('landscape', 'pt', 'a4');
- doc.text(100,40,'Relatório das Vistorias');
- doc.addImage(img, 'JPEG', 100, 100);
- doc.save("Relatorio.pdf");
- }
- })
- // var doc = new jsPDF('landscape', 'pt', 'a4');
- // doc.text(0,10,'numero');
- // doc.setFontSize(9);
- // doc.fromHTML($('#geraPDF').html(), 0, 0, {
- // 'width': 1000,
- // });
- // doc.save('sample-file.pdf');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement