Generating PDF invoices using Lago
getlago.com
getlago.com
At the end of the day, you just need to generate a PDF from a template. The template is a solved problem. Invoices generally do not have that huge amount of variability in terms of layout.
I have been using microinvoice (https://github.com/baptistejamin/node-microinvoice) for the past couple of months and it's been a breeze. It uses PDFKit underneathe and has been working really well. I don't think PDF generation is a task that should require using Chromium. There's pandoc & other libraries that can easily do this at a much lower cost to both resources and finance.
The blog posts sounds like its solving a problem that doesn't exist. Generating invoices _at scale_? Is scalibility really a problem here? Generating a PDF takes a couple of milliseconds. Rent a $5 VPS and it can generate all sorts of PDFs for you without an issue for a long time before you'd start worrying about scalability. Heck this sort of thing doesn't even need to be a dedicated service.
Not to downplay anyone's hard work but Lago just doesn't sound like it's solving a real problem.
I can only speak for what we've experienced first hand, in our prev. company (a $5B B2B fintech) we spent a lot of time around billing x invoicing in pdf :
- When billing is complex (lots of fees, different billing cycles, usage based consumption) - And you need to have a clear "invoice presentation" to avoid triggering questions (that is maintained while you iterate on pricing, launch new products or countries) the "template isn't really a solved problem", and our eng. team did rebuild the system in-house. We would have avoided it if it could have been possible and looked at every possible option, in-depth.
We've seen similar needs for marketplaces or vertical saas as well.
However thanks for the feedback, we could have done a better job at explaining why it can be a pain in specific use cases! And I was the 1st person to say, when I first discover the painpoint "there must be an existing solution for that, please don't build anything in-house".
So does Lago have a template for all these use cases? What happens when a new unique case comes up? Is Lago flexible enough to handle all the cases? Current and future ones? How is that different than having a flexible template? What actually is the problem with that?
It seems like the % of customers that care to have PDF over an HTML page would greatly affect the need for scalability.
What is this percentage, I don’t know. I wouldn’t have guessed high.
Anecdotally even when I’ve preferred a PDF invoice, it’s been on a case by case basis.
But intricate pricing is unavoidable in some industries. Often to materialize physical or logistical constraints. Take cloud computing. There is elasticity, but some order of magnitudes are only reachable if you pay the price. Or you might get volume discounts. All of this requires segmented pricing.
How would you lay out an n-dimensions matrix on a 2D piece of paper? This is data design all over again.
With an invoice targeting the right audience, you can let your customer figure these complex schemes by themselves (and have them not feel cheated). It will make your support team happy to not have to answer the "where my money goes?" question ad nauseam.
And at the end we can't just send a JSON dump to the bookkeepers. The law still requires that document we call an invoice. So yes, I think invoice UX is a thing and is here to stay.
The solution was to use JasperReports. The business could design their templates in a iReport Designer, test with dummy data, put the jrxml templates in a dedicated storage, and a simple http call would merge the real data with the template in a java service (200 lines of code) resulting in a PDF. That PDF would then get printed using ColdFusion cfprint (those huge multi-source laser printers with 10 different drawers). It was worth spending £800 for CF just for the cfprint stuff.
Hundreds of these were printed and generated every day.
You just reminded me of a customer I was working for as a junior ERP consultant. They required us to have the proof a document was printed by a user.
I went far down the rabbit hole trying to come up with an end-to-end solution involving cryptographically signed messages sent to the printer, a physical QR code on the document to be scanned back for validation, and others convoluted half-backed contraptions. But I couldn't find an unhackable way to reconcile the state in the machine with the reality of the physical world.
A senior consultant solved it in 10 minutes. Showed them. They were ecstatic and we were paid.
What has he done? Just updated a "printed" column in the database to "True" when the user clicked the HTML "print" button.
Regardless what we think about it, the man was driving a Zonda and his garage has seen a couple of Koenigseggs, and I still build software.
In my case I'm pretty sure the owners didn't care about the printed documents and never checked them. It was just required to have a proof because... process.
That's when I understood ERPs were not about software but workflow. Not a solution either, but a symptom. Some requirements are bullshit, because nobody has the time (or mandate) to question the sacred Process.
I quit doing ERPs not long after that.
Ran into it in a legacy project a few years ago, it was a total mess.
The way the templates were written wasn't clear in regards to how the fields will be filled out, conditions and scripts for the visibility of certain sections were problematic (no proper linting/syntax checks outside of runtime), there were problems with system fonts, there were problems with selecting data for filling out the templates, there were problems with the template files looking broken in different versions of the GUI software, there were problems with getting like 50 warnings after opening the template and moving any element a few pixels broke the entire template.
If possible, I'll avoid the technology, especially after trying to migrate the project to JDK 11 broke because of incompatibilities of that version of the library. Personally, I think that HTML output that then can be rendered to PDF is the only decent option in this space, which will save you many headaches.
How much better is SSRS in these aspects than the aforementioned Java-based solutions? Or I guess “paginated reports” in Power BI nowadays.
I've seen Anvil (a YC co) is building a product dedicated to this challenge, check it out!
What issue have you had? What do you mean by "custom"?
What's complex is: - Dynamic PDFs: you're trying to digitize a government process for instance, by launching online forms with a variety of user paths for the answers and generating a PDF with the answers that still fits specific government requirements - Doing it at scale
shot-scraper pdf myfile.html -o output.pdfNowadays I'll go straight to https://weasyprint.org to produce PDFs in Python. That's what I used for https://scaleway.com invoices.
I never had any problem generating PDFs by using Ghostscript.
Edit: I can see now that someone has posted a link to the repository of their backend / API source code too. Many must have missed that earlier, and hence the query.
Generating PDF invoices using Lago