Let’s say you wrote a shopping cart. You’re almost finished with the shopping cart, but there is one thing missing: sending out the purchase invoice! In most cases, the invoices are sent out in  Portable Document Format (PDF).

Why PDF? Here’s a rather simple answer: PDF is easy to use and almost any device can read documents in that format.

Let’s get into it!

Assuming you know very very basics of JavaScript, let’s start by making our little project directory. Open your terminal and write this command:

$ mkdir js-to-pdf && cd js-to-pdf

Pretty self-explanatory. We make the project and navigate into the project folder.

Next up, let’s make the index.html file:

$ touch index.html

With the help of the jsPDF  package, we can generate PDFs from the client side.

#web-development #html #javascript

How to Generate PDF Invoices with JavaScript
12.15 GEEK