Notes to self

InvoicePrinter 2.0

InvoicePrinter is intentionally small and straight-forward library, command line client, and server to make PDF invoices in no time. Version 2.0 includes buyer/seller boxes simplification, decoupling server from the library, offering sample TTY fonts as an add-on and official Docker support.

You asked for a new approach to buyer/seller boxes as they were a bit tied up with a format of “street + number” and therefore not very accommodating to “number + street” known in the English world. On top if felt wrong to be using an address field to provide a different value such as e-mail address. To that end, I redesigned it so that both are simple strings (provider_lines and purchaser_lines) where you handle new lines yourself.

Perhaps not that “fancy”, but much more flexible! 2.0 will also still accept the old API with a warning, but it will be most likely removed in 2.1.

InvoicePrinter 1.2 added server support which also brought Roda and Puma dependencies that – although not required when running the library – are part of the dependency tree and downloaded even if unused. Since the gem is really small I was thinking of just making them optional, but in the end I decided to split the gem into two; there is now a separate invoice_printer_server gem.

It also became clear to me that in most projects you end up needing a TTY font. This library just offloaded the task to the user as the underlying Prawn does (by not shipping any extra TTY font), but I want to make the library super simple to use from the get go (which picking and download a font is not) and so another invoice_printer_fonts gem was born. If installed, users can use one of the supported builtin fonts by providing its name instead of the full path to the TTY font file. overpass, opensans, and ruboto are included as of now. Feel free to open a PR with a good additional font.

The server edition asked for an official Docker container, since this is the way many might use InvoicePrinter Server outside a Ruby project. You don’t need to know any Ruby or mess up with Ruby installation to take advantage of it. And the -fonts gem is included too! Finally, 2.0 also uses a strict base64 encoding in the server API so it can be consumed by various libraries that default to the strict version.

If you want to try this version out, it’s released as 2.0.0.beta3 so don’t forget to pass --pre to the gem install command.

I hope you like this slow evolution of this gem, and I welcome your thought on GitHub or Twitter.

by Josef Strzibny