Well Reputed PDF Invoice Generator Package

Generate PDF invoices easily by using nice invoice package based on nodejs.

·

2 min read

If you are looking for PDF invoice generator then you are on right page. I had been facing issues to generating PDF invoice when I decided to create my own. So I created this package which is based on nodejs. It has one dependency pdfkit.

nice-invoice.png

Installation and Usage: You can easily install this package by following steps,

npm i nice-invoice

Once you install it, you need to include the package into your file where you want to use it,

const niceInvoice = require("nice-invoice");

And this is the third and the last step in which you need to create an object and store all information that you want to display in your PDF invoice.

An example object is following,

const invoiceDetail = {
    shipping: {
      name: "Micheal",
      address: "1234 Main Street",
      city: "Dubai",
      state: "Dubai",
      country: "UAE",
      postal_code: 94111
    },
    items: [
      {
        item: "Chair",
        description: "Wooden chair",
        quantity: 1,
        price: 50.00, 
        tax: "10%"
      },
      {
        item: "Watch",
        description: "Wall watch for office",
        quantity: 2,
        price: 30.00,
        tax: "10%"
      },
      {
        item: "Water Glass Set",
        description: "Water glass set for office",
        quantity: 1,
        price: 35.00,
        tax: ""
      }
    ],
    subtotal: 156,
    total: 156,
    order_number: 1234222,
    header:{
        company_name: "Nice Invoice",
        company_logo: "logo.png",
        company_address: "Nice Invoice. 123 William Street 1th Floor New York, NY 123456"
    },
    footer:{
      text: "Any footer text - you can add any text here"
    },
    currency_symbol:"$", 
    date: {
      billing_date: "08 August 2020",
      due_date: "10 September 2020",
    }
};
niceInvoice(invoiceDetail, 'your-invoice-name.pdf');

Also, I would like to mention that there are few optional parameters, you may leave them blank

company_logo: company_logo: "", tax: tax: ""

In the last, you need to run your file, and right after execution pdf the file would be in the same directory.

In case if you want to checkout npmjs and GitHub Url of this package,

https://www.npmjs.com/package/nice-invoice https://github.com/ayazshah2/nice-invoice#readme