At Zomato, we love food and we love data. And sometimes, those two passions collide in the creation of beautiful, portable, and secure PDFs. From invoices and receipts to detailed reports, PDFs are a cornerstone of our operations and a staple across the industry. However, our existing PDF generation process, powered by a PHP-based library, was starting to show its age. We encountered latency issues, especially during the peak hours and the situation worsened with complex, multi-page PDFs that included significant graphical content.
We needed a solution that could sustain our growing demands – something faster, more efficient, and scalable.
In pursuit of a more tailored and efficient approach, we decided to develop our in-house PDF generation solution. We chose Go as our programming language, given its performance and our team’s familiarity with it.
For rendering, we leveraged Rod, a go library for controlling headless Chromium. For PDF signing, we integrated Go PDF (digitorus/pdf), allowing us to generate and sign PDFs directly from HTML templates. This approach gave us full control over layout, styling, and security.
To ensure the authenticity and integrity of our PDFs, we implemented digital signing using a custom certificate. This adds a layer of security and trust to our documents, which is especially important for sensitive information like financial transactions.
We’re always looking for ways to improve performance, and Espresso is no exception. We implemented several optimizations to make our PDF generation process as fast and efficient as possible:
We developed a small front-end application to accompany this system, allowing anyone at Zomato to create and customize PDF templates effortlessly. This tool empowers users to modify existing templates or design new ones from scratch, all while receiving real-time feedback on the appearance of their final PDF output.
Driven by our commitment to open source, we’re excited to announce that Espresso is now available for everyone. You can deploy it in your environment, tailor it to your specific requirements, or even actively contribute to its ongoing development. This includes the lib package, which you can utilise as a library within your Go applications to build and customize your PDF generation solutions.
We hope that Espresso will serve as a powerful asset for organizations and developers seeking a rapid, efficient, and dependable PDF generation solution.
You can find the repository on github: https://github.com/zomato/espresso. We’re offering Espresso and the packages with a very permissive MIT license, allowing developers to utilise it as per their requirements/needs while retaining full ownership of the data.
Espresso isn’t just fast – it’s incredibly fast. Espresso has been successfully deployed across the majority of our PDF generation workflows, delivering consistently impressive performance metrics.
These numbers were witnessed when running espresso as an AWS ECS service with 4vcpu and 4G memory. This scaled to a hundred containers at peak load.
Espresso’s efficiency is truly remarkable. Compared to our prior system, it demands significantly less infrastructure, drastically reducing resource consumption. This translates directly into substantial cost savings, resulting in a 90% deduction in server costs for generating the same volume of PDFs.
Espresso is the culmination of our quest for the perfect PDF generation solution. It delivers simplicity, speed, efficiency and unwavering reliability, all within an open-source framework. We’re proud of what we’ve built and are excited to share it with the world. So go ahead, grab a cup of your favorite beverage, and give Espresso a try. We think you’ll find it’s the perfect blend of speed, simplicity, and power.
And remember, much like a perfectly brewed coffee, the most effective solutions are often discovered in the simplest of places.