Not so long ago I announced first stable release of InvoicePrinter. I wanted to say that the API is stable and people to experiment with it. I am happy to see that the project got already over 3 hundred stars and 20 forks. Wow, thanks! This kind of support motivates me to work on the next version more intensively. Speaking of which… here is what’s coming in 1.1.0 release.
A4 page size support
When I started this project I didn’t think too much about paper versions since I was always handling invoices online. Prawn default is letter size and not A4 and that’s why the first version supported only this letter page size (not to be confused with full American letter support in terms of position of the purchaser address, it’s not supported yet).
Luckily Joel “The Merciless” Meador started to experiment with the support of both letter and A4 page sizes, I took over the experiment, finished it and we now support both!
To generate A4 page size invoice just set
InvoicePrinter.print( document: invoice, labels: labels, page_size: :a4, file_name: 'invoice.pdf' )
All examples on GitHub now come with and are tested against both letter and A4 versions.
The side effect of working on proper A4 page size support is that I realized how off the initial layout was. Both letter and A4 versions now enjoy much more pixel perfect layout which I hope I can make 100% perfect in the upcoming versions.
You can now (de)serialize InvoicePrinter objects to JSON. The following methods are now available:
InvoicePrinter::Document.new(...).to_json InvoicePrinter::Item.new(...).to_json InvoicePrinter::Document.from_json(json) InvoicePrinter::Item.from_json(json)
Command line client
In case you would like to invoice from command line like true hackers (do they? do they really?) I included
invoice_printer executable. This is also handy if you just want to shell out from different programs. To use this you must provide the invoice in JSON format. If you are unsure how that looks like just create standard Ruby object of the invoice and call
to_json. That easy.
Command line support needs more testing right now. You can run
invoice_printer command with
--debug option in case you will face some errors.
As always, please help me to test the release candidate before the final version:
$ gem install invoice_printer --pre
← BUY THE PRE-RELEASE
I am writing a complete guide on web application deployment. Ruby with Puma, Python with Gunicorn, NGINX, PostgreSQL, Redis, networking, processes, systemd, backups, and all your usual suspects. 23 chapters and 3 scripted demonstrations already available.