A NodeJS Based Invoice Generator Package
An easy and quick way to create an invoice in PDF.
Recently I tried to develop a package for generating invoices in nodejs. After spending few hours on research I found a well-reputed package pdfkit
that is so easy to use it. By using this package, I decided to develop my own package for generating invoices which name is Nice Invoice.
How to use it?
Here are few steps to use it, so first of all please run the following command to install it
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.
I would like to add a screenshot of an example invoice

Stat
I would like share to the stat of NPM Nice Invoice Package. According to npm-stat, it has 2,959 downloads.



In case if you want to checkout npmjs and GitHub Url of this package,
https://www.npmjs.com/package/nice-invoice
Also, checkout complete and updated details about this package on below link
https://coderadvise.com/best-pdf-invoice-generator-package-of-nodejs/