How to fill PDF forms in Cloudflare Workers without Chromium or AWS Lambda
Developers building on Cloudflare Workers have traditionally relied on headless Chrome or AWS Lambda to generate and fill PDF forms, but neither approach is compatible with Workers' V8 isolate architecture. Workers run without a filesystem, subprocess support, or the memory headroom required to bundle a full browser binary. AcroForm filling — writing values into existing PDF fields — is pure byte manipulation and does not require a browser, making it well-suited to a stateless edge function. A lightweight approach involves fetching a blank PDF template from Cloudflare R2, passing field values to a hosted PDF API endpoint, and returning the filled document — all within a single Worker of around 35 lines. This eliminates the need for a second runtime, avoids Lambda cold starts, and removes the latency penalty of routing requests through a distant AWS region.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in