Making PDF invoices from JavaScript and Node.js

This is an example of how to use the new InvoicePrinter Server that I announced recently to start invoicing from your Node.js projects.

Before we start writing any JavaScript let’s install invoice_printer gem and start the server that will generate the final PDF for us:

Once we have that in place we can start out with specifying the actual invoice object (in form of JSON):

As you can see, creating one is pretty straightforward. After that we just need to send one request to get PDF version. In the following example I will also save the final PDF on disk.

And that’s how you can generate invoices from Node.js with a little help from Ruby :).

Leave a comment

Your email address will not be published. Required fields are marked *