GithubHelp home page GithubHelp logo

baptistejamin / node-microinvoice Goto Github PK

View Code? Open in Web Editor NEW
119.0 4.0 17.0 1.36 MB

Fast & elegant PDF invoice generator for Node using PDFKit. No Puppeteer

License: MIT License

JavaScript 100.00%

node-microinvoice's Introduction

node-microinvoice

NPM Downloads

Fast & elegant PDF invoice generator for Node using PDFKit.

  • What Microinvoice does?
  • It builds invoices that looks good
  • Generates a PDF in less than 30ms
  • Custom Styling & Text
  • Covers extended charsets like Russian, Polish (native PDF fonts only supports Latin)
  • Transliterate to Latin when charset is not supported (Chinese, Arabic)
  • How invoices looks like ?

Example

Why another invoice generator

This project was made for our own company Crisp. We are generating everymonth thousands of HTML invoices. Given this scale, using Puppeteer for generating HTML to PDF would be very inefficient.

As everyday, our customers were asking for PDF invoices as some accounting softwares automatically fetch invoices from emails. I could really understand their frustration. At the end, why generating PDF should be easy?

Who uses it?

Crisp

๐Ÿ‘‹ You use microinvoice and you want to be listed there? Contact me.

How to install?

Include microinvoice in your package.json dependencies.

Alternatively, you can run npm install microinvoice --save.

How to use?

Import the module in your code:

var MicroInvoice = require("microinvoice");

let myInvoice = new MicroInvoice({
  // Use example from examples/index.js
});
// Render invoice as PDF
myInvoice.generate("example.pdf").then(() => {
  console.log("Invoice saved");
});

node-microinvoice's People

Contributors

baptistejamin avatar gmouron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-microinvoice's Issues

I propose to add a builder

It seems to me that the builder design pattern is most suitable for this library.

const brandInvoiceBuilder = new InvoiceBuilder()
   .useStyles(
       new StyleBulder()
           .withDocument({ marginLeft: 30, marginRight: 30, marginTop: 30 })
           .withFonts({ ... })
           .withHeader({ ... })
       // or use style objects as well
       // if you pass style builder, invoice builder will build your styles automatically
   );

// then in any business logic
brandInvoiceBuilder.generate(invoiceData, 'path/to/your/invoice.pdf');

If you don't use custom styles, it will generate an invoice with default styles. Also if you use StyleBuilder with no or partial use of its methods, it will create default styles or your styles that have been merged with the default styles

const defaultInvoiceBuilder = new InvoiceBuilder();
// or new InvoiceBuilder().useStyles(new StyleBuilder())
defaultInvoiceBuilder.generate(invoiceData, 'path/to/your/invoice.pdf'); 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.