in Developer Experience

PDF invoicing for any project with InvoicePrinter Server

Next release of InvoicePrinter will include a server with JSON API. That means you will be able to create simple and beautiful PDF invoices in seconds from any tech stack.

Today I released a preview version of 1.2 release in form of 1.2.0.alpha1. The main addition is a runnable server:

$ gem install invoice_printer --version 1.2.0.alpha1
Fetching: invoice_printer-1.2.0.alpha1.gem (100%)
Successfully installed invoice_printer-1.2.0.alpha1
Parsing documentation for invoice_printer-1.2.0.alpha1
Installing ri documentation for invoice_printer-1.2.0.alpha1
Done installing documentation for invoice_printer after 0 seconds
1 gem installed
$ invoice_printer_server
Starting InvoicePrinter Server...
[15164] Puma starting in cluster mode...
[15164] * Version 3.11.3 (ruby 2.4.3-p205), codename: Love Song
[15164] * Min threads: 0, max threads: 16
[15164] * Environment: development
[15164] * Process workers: 2
[15164] * Phased restart available
[15164] * Listening on tcp://
[15164] Use Ctrl-C to stop
[15164] - Worker 0 (pid: 15166) booted, phase: 0
[15164] - Worker 1 (pid: 15171) booted, phase: 0

Once running you can use /render and /print endpoints for generating your PDF invoices.

Here’s an example of a request to render an invoice using curl:

$ curl -X POST -H "Content-Type: application/json" --data '{"document":{"number":"c. 198900000001","provider_name":"Petr Novy","provider_tax_id":"56565656","provider_tax_id2":"","provider_street":"Rolnicka","provider_street_number":"1","provider_postcode":"747 05","provider_city":"Opava","provider_city_part":"Katerinky","provider_extra_address_line":"","purchaser_name":"Adam Cerny","purchaser_tax_id":"","purchaser_tax_id2":"","purchaser_street":"Ostravska","purchaser_street_number":"1","purchaser_postcode":"747 70","purchaser_city":"Opava","purchaser_city_part":"","purchaser_extra_address_line":"","issue_date":"05/03/2016","due_date":"19/03/2016","subtotal":"Kc 10.000","tax":"Kc 2.100","tax2":"","tax3":"","total":"Kc 12.100,-","bank_account_number":"156546546465","account_iban":"IBAN464545645","account_swift":"SWIFT5456","items":[{"name":"Konzultace","quantity":"2","unit":"hod","price":"Kc 500","tax":"","tax2":"","tax3":"","amount":"Kc 1.000"},{"name":"Programovani","quantity":"10","unit":"hod","price":"Kc 900","tax":"","tax2":"","tax3":"","amount":"Kc 9.000"}],"note":"Osoba je zapsána v zivnostenském rejstríku."}}'

And result:


Please try it out and let me know what you think. I hope I polish the docs before the final release.

Subscribe for insights on Ruby, Rails, JavaScript, and more. Sent no more than once in 2 months.

Write a Comment