/falcon-invoice

Generate PDF invoices using html templates and mustaches!

Primary LanguageHTML

falcon-invoice

Generate PDF invoices using HTML templates and mustaches!

Installation

npm install falcon-invoice

Usage

Check out test/index.js for a more detailed example!

const invoice = require('falcon-invoice')

const template = '/path/to/template'
const templateVariables = {
  name: 'Herp Derpington'
}

// Optional options
const options = {
  filename: 'differentName.pdf',
  pdfOptions: {
    orientation: 'landscape'
  }
}

invoice(template, templateVariables, options).then(function(success){

}).catch(function(error){
  
});

Template Example

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <p>
      Customer Name: {{name}}
    </p>
  </body>
</html>

Output example

alt text

Credits

This package uses: html-pdf and mustache

I got my test html template from: https://github.com/NextStepWebs/simple-html-invoice-template