DocPro

How on-device PDF tools work (and where they struggle)

A website can edit your PDF without ever receiving it. Here is how that works, which open-source libraries do the job, and where on-device tools hit their limits.

Most people assume a website needs your file on its servers to change it. That was true for a long time, but modern browsers are powerful enough to do the work themselves. When a PDF tool is built this way, your file is read from your device by the page's code, changed in memory and saved back to your device. Nothing needs to travel anywhere.

This guide explains the pieces involved using DocPro as the example, because we can check its source. The same ideas apply to any on-device tool.

What happens when you choose a file

When you pick a file in a web page, the browser gives that page a handle to it. The page can read the bytes with standard browser features, but only for files you chose. The page's JavaScript then works on those bytes. If it never calls a network function with the contents, the file does not leave the device. The result is created as a new file in memory and offered as a download. The original is untouched.

JavaScript and WebAssembly

JavaScript runs in every browser and is fine for many tasks. Heavier work, such as OCR or encryption, needs more speed. WebAssembly (WASM) is a compact binary format that browsers run at close to native speed. Existing C and C++ programs can be compiled to WebAssembly, so a mature library can run unchanged inside a web page. Both run inside the browser's sandbox, which limits what code can touch on your device.

The libraries doing the work

DocPro's web app vendors its libraries, which means they are copied into the site and loaded from the same origin instead of a CDN. Its vendor notes list the versions and licences. The main ones are:

All of this is open source, which makes the approach auditable.

Working offline

Because the code runs on your device, the tools can work without a connection once the page and libraries are cached. DocPro is a progressive web app: it registers a service worker that stores the app shell and tool modules, and caches the larger libraries the first time a tool needs them. Then it can run offline, and you can install it from your browser. The catch is the word first. If you have never used OCR on this device, the OCR files have to be downloaded once. Open the tools you care about while you are online.

What on-device does and does not mean

Running locally means the document content is not sent to a server. It does not mean the website never talks to the internet. The page itself loads from a server. An account system, such as DocPro Pro sign-in, talks to an API to check a subscription. Analytics, if any, may send usage data. The question to ask is whether the file contents are sent. You can test it yourself with our guide on how to check whether a PDF website uploads your files.

A web page can also restrict itself. DocPro's Content Security Policy tells the browser to allow connections only to its own site and its account server, so a bug or a rogue script would have trouble sending a document elsewhere.

Limits you should know about

When on-device is the right choice

Use on-device tools for private documents, quick jobs, flights and poor connections, and any time you do not want an account. Use a server-based service or a desktop editor when you need heavy features, exceptional fidelity or very large files. See the roundup of free PDF tools for options in both groups.

For the privacy background, read why private documents deserve extra care.

Open Merge PDFs

Tools used in this guide

More guides