Hello everybody, and welcome to another deep dive into the world of cutting-edge technology! We are back with another episode that promises to take you behind the scenes of some truly remarkable engineering. If you’ve been with us for a while, you know we love bringing you stories that go beyond the surface, stories that show how brilliant minds solve complex technical challenges.
Today, we are going to take up a topic that was recommended to us by one of our listeners. We will unpack a fascinating tale of innovation that might just change how you think about something as seemingly mundane as PDF generation. But trust me, by the end of this episode, you will see that even the most apparently simple technical problems can be transformed into works of engineering art.
Let us set the stage. Imagine you’re working at Zomato, a company that lives and breathes data. We are talking about an organization that deals with millions of transactions, countless receipts, intricate reports, and a mountain of documentation that would make most administrative systems buckle under pressure. PDFs are not just files for these guys – they are the lifeblood of their operational ecosystem.
But here is where our story gets interesting. Every great technical solution begins with a problem; for Zomato, that problem was their existing PDF generation system. Picture an old, creaky machine struggling to keep up with the demands of a fast-paced, data-driven environment. Their PHP-based library was showing its age, plagued by latency issues that became more pronounced during peak hours. Complex, multi-page PDFs with rich graphical content? Those were becoming a nightmare.
Now, let us talk about what most companies might do in this situation. They might shop around for a commercial solution, negotiate with vendors, or simply learn to live with the performance bottlenecks. But that is not the Zomato way. These are engineers who do not just see problems – they see opportunities for innovation.
Their solution? A project they would come to call Espresso – a name that is no coincidence. Just like a perfect espresso shot is about precision, speed, and extracting maximum flavor in minimal time, this PDF generation system would be all about efficiency and performance.
The technical choices they made are nothing short of brilliant. They chose Go as their programming language, and there is a good reason for that. Go, developed by Google, is renowned for its performance, concurrency support, and simplicity. It is like the Swiss Army knife of programming languages – powerful, versatile, and designed for modern computing challenges.
For rendering, they turned to Rod, a Go library for controlling headless Chromium. Now, for the tech enthusiasts out there, this is where it gets really interesting. Headless Chromium means they’re using a full web browser environment to generate PDFs but without the overhead of actually displaying a graphical interface. It is like having a super-intelligent robot that can read and render web pages at lightning speed.
But rendering was just the beginning. They also needed a robust solution for PDF signing – a critical requirement for maintaining document integrity and security. Enter Go PDF (digitorus/pdf), a library that allows direct PDF generation and signing from HTML templates. This approach gave them unprecedented control over layout, styling, and security.
Let us break down some of their optimization strategies. These are not just minor tweaks – these are fundamental re-imaginings of how PDF generation could work:
First, pre-paint PDF generation. By generating the PDF before the actual paint step of the rendering process, they saved crucial milliseconds. In the world of high-performance computing, milliseconds matter.
Then there are the Chromium flags. Most developers would just use default settings, but not the Zomato team. They meticulously fine-tuned various Chromium flags to improve application start times. It’s like souping up a car’s engine in the digital realm.
DataURI image prefetching was another stroke of genius. Instead of making the browser download images during page load, they prefetch HTML images and save them as dataURIs. The result? Reduced rendering costs and faster PDF generation.
But perhaps most impressively, they combined PDF generation and signing into a single application, working with streams instead of files. This approach reduced disk I/O – a common bottleneck in many systems – and further improved performance.
The numbers are frankly mind-blowing. Espresso can render and sign PDFs in under 200 milliseconds. At peak load, it handles 120,000 requests per minute. In one particularly impressive demonstration, they signed 1.6 million PDFs in just 19 minutes – that’s approximately 1,400 PDFs per second!
And the infrastructure efficiency? A 90% reduction in server costs compared to their previous system. In an era where cloud computing costs can spiral quickly, this is nothing short of revolutionary.
But the Zomato team didn’t stop at building an internal tool. Embracing the open-source philosophy, they made Espresso available to the global developer community. The entire system, including a library package, is now on GitHub under an MIT license. It is an invitation to developers worldwide to learn, use, and contribute.
They even built a front-end application that allows anyone at Zomato to create and customize PDF templates. It’s like giving every team member the ability to be a PDF brewing master, with real-time feedback on template design.

For developers listening, this is more than just a success story. It is a masterclass in solving real-world technical challenges. It demonstrates how choosing the right technologies, focusing on performance, and maintaining a spirit of continuous improvement can transform a simple utility into a game-changing solution.
If you are intrigued and want to dive deeper, head over to the Espresso GitHub repository. Explore the code, understand the architecture, and maybe even contribute your own improvements.
And for those of you looking to level up your engineering skills, this is exactly the kind of project that can teach you more than any textbook. It’s about understanding systems, optimizing performance, and always asking: “How can we make this better?”
We hope this episode has given you a fresh perspective on PDF generation, system optimization, and the incredible potential of innovative engineering. Until next time, keep learning, keep exploring, and never stop brewing amazing solutions!
Stay curious, and happy learning!