Business
7 min readA few months ago, we got one of those project requests that sounds simple until you start thinking about it. Our client had hundreds of distributors who all needed their own marketing flyers – same basic product info, but customized with different branding, pricing, and dealer details. And they wanted print-ready PDFs generated on demand.
My initial reaction was basically "great, time to learn some weird PDF templating language." Turns out I was wrong about that part.
Picture this: you've got 200+ distributors who all sell your products, but they each need their own version of your marketing materials: different logos, different contact info, sometimes different pricing structures. In the traditional approach, this means either someone manually creating hundreds of PDFs every time product info changes, or building some complex backend templating system that nobody wants to maintain.
Our client was pretty straightforward about their needs:
Seemed reasonable enough.
I'll admit it – instead of diving into Google searches like I used to, I started by asking Juni AI what my PDF generation options were. Juni is JetBrains' assistant that's built right into IntelliJ, and since it has the context of the whole project, it can give you a better overview than just random Stack Overflow results.
Juni pointed me toward React PDF renderer, and once I looked into it, the appeal was immediate. It's just React. If you know React, you're 90% there already. Instead of learning some proprietary templating system, I could use <View>, <Text>, and <Image> components. The styling is basically CSS.
Part of the goal was not to have to learn an entirely new template system just to make a PDF. I could look at the web version of our designs and create the PDF markup from that.
Plus, it runs entirely in the browser – no new backend services, no server-side rendering complexity, no deployment headaches.
The implementation ended up being more straightforward than expected. Since we were already using Broadleaf's content services for the product catalog, we didn't need to build any new APIs. Just focused on the frontend:
We added a "Generate Flyer" button right in the admin interface. Click it, get a PDF. The system supports multiple templates that can be duplicated and customized at the distributor level. Each dealer can have their own version without affecting others.
The tricky part was the data flow. Unlike web pages, PDFs don't update once they're rendered in the browser. All the product data, images, and branding have to be loaded before rendering. You have to get everything right the first time.
One feature I was pleased with was the QR codes. Each flyer gets a QR code linking back to the online product page so that customers can check current pricing or availability even from a printed piece.
About 80% through the project, we hit a major snag: all the client's product images were in GIF format. React PDF only supports PNG and JPEG.
In the old days, this would've meant hours of research and Stack Overflow diving. Instead, I asked Juni: "Is there any way to convert a GIF into a PNG in the browser?"
Juni told me exactly what to do: draw the GIF onto an off-screen canvas, export it as PNG, and use the data URL. I gave it a bit more context about our setup and said, "Just do that." Within fifteen minutes of discovering the bug, it was fixed and development was able to continue.
That's what I appreciate about AI tools that actually work – they're not replacing your thinking, they're eliminating the tedious research questions that eat up your day. If I'd had to figure that out from scratch, it easily could've been hours or a full day.
Two templates got us started with this client, but the system scales to handle any number. Each template can be customized at different levels without touching the backend code. Dealers create multiple versions, override defaults, and tailor content to their specific needs.
The beauty is that since Broadleaf already had access to all the catalog data – the right product images, descriptions, pricing – there's minimal editing needed. You're pulling data that's already web-ready and customer-facing, not raw ERP descriptions.
This approach works beyond just auto parts distributors, too. Retail chains doing weekly flyers, B2B companies creating invoices, grocery stores sending promotions – the same architecture applies.
Juni was genuinely helpful throughout this project, but not in some magical "AI did all the work" way. It accelerated research, helped with unexpected problems, and maintained consistency across the codebase.
The biggest difference between Juni and something like GitHub Copilot is the project context. Juni knows the project structure, how files work together, and can run commands and tests. When you ask it something, it can really churn on the problem internally and give you a more robust response.
At the start of the PDF process, I already had web versions of the two templates. I created the PDF version of the first template by hand. Then I asked Junie to create the second PDF template by referencing the second’s web version and both the web & pdf of the first template. It gave me a solid starting point – definitely not a final product, but it saved a good chunk of development time.
If you're thinking about doing something similar, a few things from the trenches:
Use React PDF's View components like divs – the mental model is basically the same as web layout.
Set your PDF size to "letter" if people are actually going to print these things.
Load everything first – make sure all data and images are ready before rendering. PDFs won't update if something loads late.
Canvas conversion trick – for unsupported image formats, the off-screen canvas approach works great.
AI for research – tools like Juni can save hours on the "how do I do X in JavaScript" questions that used to require deep Stack Overflow diving.
This project got me thinking about how much manual work we still accept in marketing and content creation. We're not talking about AI replacing creativity – we're talking about eliminating tedious, repetitive tasks so people can focus on strategy, design, and messaging.
Before, our client had to maintain catalog data in multiple places to create marketing materials. Now they pull from the same data that powers their online store. Everything stays in sync, and we're saving some trees since people don't need to print catalogs that are outdated by the time they arrive.
Sometimes the best solution isn't the fanciest one. We didn't need some complex PDF generation service or proprietary templating language. We just connected existing tools in a smart way.
And yeah, AI helped – not in transforming everything, but in handling the boring research and troubleshooting that used to eat up development time. That's probably what good developer tools should do: eliminate friction so you can focus on building something useful.
The tools are out there, they're getting easier to use, and the results speak for themselves. Dynamic, branded marketing materials generated on demand, always up to date, customizable for hundreds of distributors.
Plus, everything's better with QR codes.