Wednesday, February 14, 2018

Export HTML to PDF using JavaScript

Building PDF files with JavaScript is simpler than you think. If you use the right tools.
Sometimes you get those requests to "export to pdf" a given web page you developed. Turns out that sometimes, and just sometimes =), it's too complex to produce a custom report, the time to setup a reporting server, the costs, etc, are too impeditive. What can we do?

It can be easily done using two popular javascript libraries: jQuery and the excellent JsPdf. Since the PDF is rendered by JavaScript, testing is as simple as running the following on your browser.


Exporting HTML to PDF is a simple task if we use the write tools. Hope it helps.


See Also

About the Author

Bruno Hildenbrand