Angularjs create / export html view as pdf

I use bootstrap to create a modal window, in this window I have some information, some tables and text areas, can I create .pdf from this .html modal view?

I looked in FileSaver, but it works well for loading tables, and I want it almost like a modal screen print screen.

+6
source share
1 answer

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'); } }); 
+2
source

All Articles