JS PDF - Export with html Canvas

0

I'musingJSpdfnowwiththemethodittakestoprintfromthescreenandthenexportsthisprinttopdf,butwhengeneratingthepdfIwouldliketomakethescreenmoreadjusted.WhenIuseLandscapeitlooksliketheimageabove,withalineinthemiddleanddoesnotfitthescreenentirely.

AndwhenIusePortraititlookslikeintheimagebeloweverythingmisaligned

SoI'dliketoknowifthere'sanythingthatcanfixthisproblem.followsthecodethatIamcurrentlyusingtoexportthescreenprinttopdf.    

functiongenPDF(){html2canvas(document.body,{onrendered:function(canvas){varimg=canvas.toDataURL("image/png");
      var doc = new jsPDF("l", "mm", [297, 210]);

      var width = doc.internal.pageSize.width;    
      var height = doc.internal.pageSize.height;


      doc.addImage(img , 'JPEG'  ,0, 0, width, height);
      doc.save('test.pdf');


}

})



}</script>
    
asked by anonymous 05.05.2017 / 06:03

0 answers