Convert web page to PDF with JavaScript

We all know how to print or save a web page as a PDF from a browser. You may even add a button using window.print() to make it more convenient. But to send the page as a PDF attachment via email or convert multiple photos online as a PDF file cannot be done using any browser’s built-in feature. How do I catch the result of window.print() and save it as a variable or object then? You asked.

Turns out it is much easier than you think, with the help of some Java-script libraries. Here I try to put together what I have learned through the course of using JsPDF in my…