How to create a pdf client side with Javascript

How to create a pdf client side with a fantastic open source library JSPDF that transforms the contents of a div into a pdf page.

After a bit of research, we came across this magnificent free library which is also updated frequently (last update was a couple of months ago)
that greatly facilitates the creation of PDF pages for user’s experience benefit, without going into details like how you generate a PDF file.

It copyes your styles applied to the div, by creating a runtime canvas of your div and then print it to a PDF file as by magic.

By declaring a variable, you can choose the orientation, portrait or landscape, format and choose, if div large to print on multiple pages (by simply setting pagesplit: false);

was made a demo available here.

by Giuliano De Luca and Codrina Turcu