granitebps.comAll case files

Moving PDF generation off the worker

PDF generation ran on a worker and kept causing out-of-memory failures. I moved it into the web app and built the layouts as React components, so PDFs are fast and reliable, and the layouts are consistent and easier to maintain.

Where the PDF is made

BEFORE
Request
Workerrenders HTML templates in headless Chrome
out-of-memory failures

AFTER
Request
Web appgenerates the PDF from React components
fast and reliable

Swipe to see the full diagram

At a glance

Before
Generated on a worker from HTML templates, with frequent out-of-memory failures
After
Generated in the web app, with layouts as React components
Result
Fast, reliable PDFs with consistent, easier-to-maintain layouts