I tried to do it using this code but it does not work for me
function genPDF() {
html2canvas(document.body, {
onrendered: function(canvas) {
var img = canvas.toDataURL("image/png");
var doc = new jsPDF();
doc.save('document.pdf');
}
});
}