I'm the developer of MakeQuickWork, a small collection of free browser tools. This post is about how one of them, PDF to JPG, works under the hood.
Most "PDF to JPG" sites follow the same pattern: you upload the file, a server renders it, and you download a ZIP a few seconds later. That works, but it means a contract, a payslip or a medical letter sits on someone else's server for a while. I wanted a version where the PDF never leaves the browser tab. It turned out to be a nice little exercise in canvas, DPI math and browser quirks.
The tool is live at https://makequickwork.com/pdf/pdf-to-jpg/ if you want to follow along with DevTools open.
The pipeline
The whole thing is four steps, all client side:
Read the File the user picked into an ArrayBuffer .
Open it with PDF.js (Mozilla's PDF renderer).
For each page, render to a <canvas> at the scale that matches the chosen DPI.
Encode the canvas with canvas.toBlob() as JPEG or PNG, and if there are several pages, zip them with fflate.
One detail that…