jspdf does not work with css but it can work along with html2canvas. You can use jspdf along with html2canvas.
include these two files in script on your page :
<script type="text/javascript" src="html2canvas.js"></script>
<script type="text/javascript" src="jspdf.min.js"></script>
<script type="text/javascript">
function genPDF()
{
html2canvas(document.body,{
onrendered:function(canvas){
var img=canvas.toDataURL("image/png");
var doc = new jsPDF();
doc.addImage(img,'JPEG',20,20);
doc.save('test.pdf');
}
});
}
</script>
You need to download script files such as https://github.com/niklasvh/html2canvas/releases https://cdnjs.com/libraries/jspdf
make clickable button on page so that it will generate pdf and it will be seen same as that of original html page.
<a href="javascript:genPDF()">Download PDF</a>
It will work perfectly.