Invoice bill manager.
Create your checkout invoice-bill, add item(s) details,
and export them in HTML and/or PDF format(s). also the rendering is based a JADE template file so you can use/edit your template and make your bill with your template.
$ npm install --save invoice-bill
const InvoiceBill = require('invoice-bill');
const sample = new InvoiceBill({
billIDGenerator: {preFlightValue: 1, mode: 'padding'},
currency: 'MYR',
from: {issuer: 'Amin Aghabeiki'},
to: 'Some body',
logo: logo, // Any base64 encoded image.
});
sample.newRecords({itemName: 'test1', itemBasePrice: 10});
sample.newRecords({itemName: 'test2', itemBasePrice: 5, itemCount: 2, discount: 5});
const test = sample.renderToHTML();
require('fs').writeFileSync('test.html', test);
sample.renderPDF(__dirname, {format: 'Letter', orientation: 'landscape'})
.then((filePath) => {
console.log(`PDF file generated @ ${filePath}`);// eslint-disable-line no-console
})
.catch((err) => {
console.log(err);
});
And also working example is available in
InvoiceBill constractor options: docs
- billIDGenerator BillIDGeneratorConfig
- from Company
- to string
- currency string
- templatePath string The JADE template path used for rendering the Bill ,
- logo string should be in base64 image format
- title title
renderPDF options: docs
- outputPathDIR string Output path for storing PDF files.
- options object The Rendering options.
- fileName string The filename, if not pass a name with title and a time stamp will be created.
For PDf rendering the module html-pdf
used,
and the rendering options is available here.
`npm test`
- Amin Aghabeiki - Initial work
This project is licensed under the MIT License - see the LICENSE.md file for details