This tutorial aims to show you how use @rimiti/invoice-it (Github, NPM) NodeJS package to easily generate invoice or order PDF files.

Invoice-it is production ready since July 1st, 2017. It use PhatomJS (Scriptable Headless Browser) from html-pdf package, which is embedded by invoice-it to convert html templates to PDF.


Why invoice it?

Invoice-it has been created to be fully customizable and supporting multi page. You can easily override default configuration to:

  • Use your own order and invoice templates.
  • Add your logo.
  • Change date format.
  • Change default locale.
  • Add / use your own locales file (to override wording).
  • Add order and invoice notes.
  • Customize you company informations (company name, address, phone, website, footer…).
  • Change document identification format (example: IN-1805-00001).


Let’s go!

As an example, let’s generate a first order containing the items below:

  1. Macbook Pro 13″ – (x3)
  2. Github licence – (x1)
  3. Apple care 1 year – (x3)

To be in real condition, I’ll fully customize the document with following informations:


Dim Solution
73 rue Victor Hugo
77340 Pontault-Combault
Phone: +33 0 00 00 00 00


Will Jameson
20 rue de Paris
75001 Paris
Phone: 00 00 00 00 00

Our footer company informations:

Dim Solution inc – Registration: 87564738493127
NAF-APE: 6202A – Num. VAT: EN28987856541

To don’t pass every time emitter and logo informations, you can configure it and exporting it.

Adding recipient informations:

There are two ways for adding articles in a document.

From an array:

From object:


It’s time to export our document ?

Invoice-it provides several formats to export document.




Isn’t it awesome ? 🙂

Invoice PDF file

Invoice PDF

Order PDF file

Order PDF


Some others examples to demonstrate you how to customize some fields:


The code present in this tutorial is accessible into this repository.

If you want more examples or snippets, you can check the official repository.


  • Nicks65
    Posted on 29 mai 2018 at 21 h 29 min

    Thank you for this nice tutorial.

  • ouss
    Posted on 29 mai 2018 at 22 h 21 min

    awesome pdf generator !

  • Alex Ellis
    Posted on 30 septembre 2018 at 23 h 41 min

    I really like this – it’d make an awesome function in the OpenFaaS Function Store. What do you think Dimitri?

    • Dimitri DO BAIRRO
      Posted on 4 octobre 2018 at 11 h 32 min

      Thank you @Alex! You’re right, this module could indeed be the subject of a nice example of using OpenFaas! I’ll will soon create a new article about it. ?

  • Daniel
    Posted on 12 février 2019 at 13 h 40 min

    Hey man! Could you please fix the header and footer so that if the amount of products is too big, next products should go on the second page, but after the header?

    Thanks for this! You rock!

    • Dimitri DO BAIRRO
      Posted on 12 février 2019 at 13 h 44 min

      Hello Daniel,

      Thank you for your feedback.
      Could you please create an issue on Github with an example of what’s wrong ?

      Github repository.

      Thanks ?

  • Daniel
    Posted on 12 février 2019 at 14 h 22 min

    Another thing.. I try to use your module with express. I also want to be able to structure the generated HTML files. Unfortunately, .toFile() method does not create a new directory if it doesn’t exists, and that prevent from organizing files. Could you please have a look? Thanks!


Leave a comment