clientside-pdf-printing

Experiments in PDF generation purely client-side using JavaScript, Canvas, etc.

At work, we’re looking into ways to use less-expensive technologies for simpler sites. And one of the “small details” that ends up being a breaker, is PDF generation. Our current technique is WkHTMLtoPDF to generate very customized PDFs (statistics, charts, maps) of content not necessarily like that on the web page. This means a server so we can use command-line tools (e.g. pdfkit for Python).

But if we can generate PDFs wholly client-side using static files, we could make strides in our quest to host at Github pages and other lower-cost and no-cost providers.

Sample URLs

https://gregallensworth.github.io/clientside-pdf-printing/rasterized/

https://gregallensworth.github.io/clientside-pdf-printing/pdfmake/

https://gregallensworth.github.io/clientside-pdf-printing/pdfkit/

Goals for a Complete Success

Summary of Discoveries So Far

Generally speaking, there are two techniques:

Credits

This is simply tests and documentation of our usage of someone else’s work, [https://github.com/eKoopmans/html2pdf the html2pdf system by eKoopmans] Donations and kudos should be directed to that author, and to those of the underlying libraries html2canvas and jsPDF.