Nominally Patriotic Meathead

    TypeScript icon, indicating that this package has built-in type declarations

    1.0.147 • Public • Published

    Easy Invoice logo

    Version Build Status Coverage Status
    Downloads License Pull Request's Welcome

    If this package helped you out please star us on Github!
    Much appreciated!

    Pull Request's Welcome

    Platform support

    Platform Repository Supported Link
    PHP Composer Yes! Available on Composer
    Javascript NPM Yes! Available on NPM
    Python PIP Yes! Available on PIP
    Java Maven In progress...


    Easy Invoice Sample Logo Only Easy Invoice Sample With Background

    JSON Configs used for above samples:


    JS Fiddle: Plain Javascript
    JS Fiddle: Vue
    JS Fiddle: React
    JS Fiddle: Angular

    Step-by-step guide

    Read our step-by-step guide on Medium. Click here!


    Using npm:

    $ npm install easyinvoice --save

    Using yarn:

    $ yarn add easyinvoice

    Using unkpg CDN:

    <script src=""></script>

    Using jsDelivr CDN:

    <script src=""></script>



    <script src=""></script>


    var easyinvoice = require('easyinvoice');


    import easyinvoice from 'easyinvoice';


    import * as easyinvoice from 'easyinvoice';
    //ór (not both)
    import { easyinvoice } from 'easyinvoice';

    Example (NodeJS)

    //Import the library into your project
    var easyinvoice = require('easyinvoice');
    var data = {
        //"documentTitle": "RECEIPT", //Defaults to INVOICE
        //"locale": "de-DE", //Defaults to en-US, used for number formatting (see docs)
        "currency": "USD", //See documentation 'Locales and Currency' for more info
        "taxNotation": "vat", //or gst
        "marginTop": 25,
        "marginRight": 25,
        "marginLeft": 25,
        "marginBottom": 25,
        "logo": "", //or base64
        "background": "", //or base64 //img or pdf
        "sender": {
            "company": "Sample Corp",
            "address": "Sample Street 123",
            "zip": "1234 AB",
            "city": "Sampletown",
            "country": "Samplecountry"
            //"custom1": "custom value 1",
            //"custom2": "custom value 2",
            //"custom3": "custom value 3"
        "client": {
           	"company": "Client Corp",
           	"address": "Clientstreet 456",
           	"zip": "4567 CD",
           	"city": "Clientcity",
           	"country": "Clientcountry"
            //"custom1": "custom value 1",
            //"custom2": "custom value 2",
            //"custom3": "custom value 3"
        "invoiceNumber": "2021.0001",
        "invoiceDate": "1.1.2021",
        "products": [
                "quantity": "2",
                "description": "Test1",
                "tax": 6,
                "price": 33.87
                "quantity": "4",
                "description": "Test2",
                "tax": 21,
                "price": 10.45
        "bottomNotice": "Kindly pay your invoice within 15 days.",
        //Used for translating the headers to your preferred language
        //Defaults to English. Below example is translated to Dutch
        // "translate": { 
        //     "invoiceNumber": "Factuurnummer",
        //     "invoiceDate": "Factuurdatum",
        //     "products": "Producten", 
        //     "quantity": "Aantal", 
        //     "price": "Prijs",
        //     "subtotal": "Subtotaal",
        //     "total": "Totaal" 
        // }
    //Create your invoice! Easy!
    easyinvoice.createInvoice(data, function (result) {
        //The response will contain a base64 encoded PDF file

    Locales and Currency

    Used for number formatting and the currency symbol:

    //E.g. for Germany, prices would look like 123.456,78 €
    const data = { locale: 'de-DE', currency: 'EUR'};
    //E.g. for US, prices would look like $123,456.78
    const data = { locale: 'en-US', currency: 'USD'};

    Formatting and symbols are applied through the ECMAScript Internationalization API

    Click here for a list of locale codes
    Click here for a list of currency codes

    Disclaimer: Not all locales and currency codes found in the above lists might be supported by the ECMAScript Internationalization API.

    Logo and Background

    The logo and url inputs accept either a URL or a base64 encoded file.

    Supported file types:

    • Logo: image
    • Background: image, pdf


    const data = {
        logo: "",
        background: "",


    const data = {
        //Note: Sample base64 string
        //Please use the link below to convert your image to base64

    Local File (NodeJS only)

    //Import fs to be able to read from the local file system
    var fs = require("fs");
    //Use the code below to read your local file as a base64 string
    const data = {
        logo: fs.readFileSync('logo.png', 'base64'),
        background: fs.readFileSync('images/background.png', 'base64')

    Click here for an online tool to convert an image to base64

    Async/await support

    const result = await easyinvoice.createInvoice(data);

    To store the file locally (NodeJS)

    var fs = require('fs');
    const data = {};
    const result = await easyinvoice.createInvoice(data);                       
    await fs.writeFileSync("invoice.pdf", result.pdf, 'base64');

    Download your invoice (browser only)

    Using callback

    const data = {};
    easyinvoice.createInvoice(data, function (result) {'myInvoice.pdf', result.pdf);
        //	you can download like this as well:

    Using async/await

    const data = {};
    const result = await easyinvoice.createInvoice(data);                  'myInvoice.pdf', result.pdf);
    //	you can download like this as well:

    Render(view) your invoice (browser only)


    <!-- Only include when rendering is required -->
    <script src=""></script>
    <script src=""></script>
    <!-- Include pdfjs version 2.3.200 for Internet Explorer compatibility, no worker required -->
    <!-- <script src=""></script> -->
    <!-- The pdf will be rendered within this div -->
    <div id="pdf"></div>

    css (optional)

    #pdf {
      text-align: center;
    #pdf canvas {
      border: 1px solid black;
      width: 95%;

    js: Using Callback

    var data = {};
    var elementId = 'pdf';
    easyinvoice.createInvoice(data, function(result) {
        easyinvoice.render(elementId, result.pdf, function(){
            console.log('Invoice rendered!');

    js: Using async/await

    const data = {}; 
    const elementId = 'pdf'; 
    const result = await easyinvoice.createInvoice(data);      
    await easyinvoice.render(elementId, result.pdf);

    You could view your base64 pdf through the following website:

    Paste the base64 string and click 'Decode Base64 to PDF'.


    npm i easyinvoice

    DownloadsWeekly Downloads






    Unpacked Size

    550 kB

    Total Files


    Last publish


    • dveldhoen