Simple invoice generator
Note: This module is not related to the PHP/Laravel invoicing site Invoice Ninja or its GitHub repository.
npm install invoice-ninja
var fs = require('fs');
var Invoice = require('invoice-ninja');
today = new Date();
due = new Date()
due.setDate(today.getDate() + 14);
input = {
currencyFormat: "£%d",
invoice_number: 1421,
date_now: today.toDateString(),
date_due: due.toDateString(),
from_name: 'nCrazed',
client_name: 'Client Inc.',
items: [
{
description: 'Freebie',
quantity: 1,
rate: 0,
amount: 0
}
]
};
var invoice = new Invoice();
invoice.generatePDFStream(input).pipe(fs.createWriteStream('invoice.pdf'));
The above code would create a pdf file that looks like this:
Optional absolute paths to your custom template and/or css files.
Type: String
Default: template.md
Type: String
Default: row.md
Type: String
Default: bootstrap.css
All but currencyFormat
are optional.
Type: String
Format string for currency values.
It's passed to util.format
as the first argument and should include
the currency symbol and the %d
placeholder.
Type: String
Type: String
Type: String
Type: Number
Type: Number
Type: Number
Type: Number
Type: Number
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: String
Type: Array
Each element of the array represent a single item.
Type: String
Type: String
Type: Number
Type: Number