invoice-generator
Generate invoices and export them easily. If you want some examples, check tests.
Install
$ npm install invoice-generator --save
Features
- Generate invoice
- Export to HTML / PDF / Stream
- Easy to use it
Usage
Importation
From import
;
From require
const invoiceGenerator = ;
If you want to export your invoice in PDF, you must install the html-pdf (v2.2.0) peer dependence
$ npm i -S html-pdf@2.2.0
Invoice
To generate an invoice:
const invoiceGenerator = ; invoiceGenerator; const invoice = invoiceGenerator; invoicerecipient = title: "Ms" first_name: "Anne" last_name: "Haworth" street1: "3/288 Glen Osmond Road" street2: "FULLARTON SA 5063";invoicestatement_conclusion = Employee: "1409" "Payroll Id": "001409" Phone: "8338 4427" Email: "anne@vehiclesolutions.com.au";invoicestatement_heading = subject: "Activity Statement" subtitle: "Salary Packaging Statement for the period FBT year to date";invoicearticle_headers = "Name" "Date" "Ref" "Inst#" "Description" "Debit" "Credit" "Balance";invoicearticles = "Payroll Deduction" "24/08/2017" "144102894" "1" "Deduction" "525.20" "" "526.21 Cr" ;
Return invoice object
invoice;
Return html invoice
invoice;
Save html invoice into file (default filepath: 'invoice.html')
invoice ;
Save html invoice into file (default filepath: 'invoice.pdf')
const options = timeout: "90000" border: top: "10px" right: "10px" bottom: "10px" left: "10px" header: height: "10mm" contents: '<div style="padding:5px 10px 5px 10px;"><div style="float:left;">Activity Statement</div><div style="float:right;"><span style="color:#444;font-size: 50%;">Print No.: ' + + "</span></div></div>" footer: height: "10mm" contents: default: '<div style="padding:5px 10px 5px 10px;"><div style="float:left;"><span>Page {{page}}</span> of <span>{{pages}}</span> <span style="color:#444;font-size: 50%;">Generated ' + + "</span></div></div>" ; invoice ;
i18n
To add more language:
const invoiceGenerator = ; invoiceIt;
Scripts
Run using npm run