covert html to canvas using html2canvas , and then use jsPdf to convert to pdf. here is a fiddle example
like this
<canvas id="canvas" width="480" height="320"></canvas> <button id="download">Download Pdf</button> html2canvas($("#canvas"), { onrendered: function(canvas) { var imgData = canvas.toDataURL( 'image/png'); var doc = new jsPDF('p', 'mm'); doc.addImage(imgData, 'PNG', 10, 10); doc.save('sample-file.pdf'); } });
source share