On this pageThree places a PDF can be processed
Contracts, payslips, scanned invoices and medical forms all end up as PDFs, and most free websites that merge or compress them want the file uploaded first. Running your own tool fixes that, but "self-hosted" covers three different designs. The real decision is where the document is processed: on your server, inside the user's browser, or in a script that never shows a web page. Each choice moves the risk, the hardware bill and the maintenance somewhere else.
Three places a PDF can be processed
| Approach | Example | Where the file goes | Best for | What you maintain |
|---|---|---|---|---|
| Server-side web app | Stirling-PDF | Uploaded to your server and processed there | Teams, OCR, an HTTP API, scheduled jobs | Accounts, updates, stored files, RAM and CPU |
| Browser-side web app | BentoPDF | Stays on the user's device; the server only sends static files | Sensitive one-off edits | A static site and its certificate |
| Command line | qpdf, OCRmyPDF, Ghostscript, Poppler | Wherever the script runs | Batch work, CI jobs, cron | Packages and the scripts |
Many teams end up with two of the three: a browser tool for people, and an API or command-line tools for machines.
Stirling-PDF: a PDF server with an API
Stirling-PDF is a web application that merges, splits, compresses, converts, OCRs, redacts, signs and edits PDFs on the server. Version 3.3.0 is the current release. It is open-core: the repository is under the MIT license, except for listed directories such as app/proprietary/ and engine/ that carry their own license files. The free plan allows 5 users, OAuth2 and OIDC single sign-on work on every plan, and SAML is an Enterprise feature.
Three things set it apart from a browser tool:
- A REST API. Nearly every tool has an endpoint under
/api/v1/, documented on your own instance at/swagger-ui/index.html. Calls authenticate with anX-API-KEYheader, and each user finds a key under Settings > Preferences > API Keys. - Pipelines. A pipeline is a saved workflow: an input (manual, scheduled or a watched folder), tools that run in order, and a destination.
- Accounts. Login is on by default. When the user database is empty, Stirling creates an
adminaccount with the passwordstirlingand asks for a new password at the first sign-in.
Run it on localhost behind a proxy
The project publishes three image variants. Start with the standard latest tag, for which the documentation suggests 4 GB of memory. latest-ultra-lite keeps only the core tools, has no login and suggests 2 GB, so it does not belong on a public address. latest-fat bundles an AI engine that is off by default and suggests 6 GB. Once a release works for you, pin its version tag.
services:
stirling-pdf:
image: docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest
container_name: stirling-pdf
restart: unless-stopped
ports:
- "127.0.0.1:8080:8080"
environment:
SECURITY_ENABLELOGIN: "true"
SECURITY_INITIALLOGIN_USERNAME: "pdfadmin"
SECURITY_INITIALLOGIN_PASSWORD: "${STIRLING_ADMIN_PASSWORD}"
SYSTEM_FILEUPLOADLIMIT: "200MB"
volumes:
- ./stirling-data/configs:/configs
- ./stirling-data/logs:/logs
- ./stirling-data/pipeline:/pipeline
- ./stirling-data/storage:/storage
mem_limit: 4g
The two SECURITY_INITIALLOGIN variables create your own first administrator instead of the default one, so admin with stirling never works on a public URL, not even for a minute. Stirling ignores them once users exist, so remove the password from .env after the first start. Then put HTTPS in front:
pdf.example.com {
reverse_proxy 127.0.0.1:8080
}
Caddy sets no request body limit by default. Nginx does: client_max_body_size defaults to 1 MB, which rejects most scans with a 413 error, so raise it to match your upload limit if Nginx is your proxy.
Trim what you do not use
Settings live in /configs/settings.yml, and every key maps to an environment variable: capitals, underscores between levels, hyphens dropped. Two are worth setting early. ENDPOINTS_TOREMOVE takes a comma-separated list of tools to disable, which shrinks what an attacker can reach if your team only merges, splits and compresses. SYSTEM_FILEUPLOADLIMIT caps uploads, and an empty value means 2000 MB. The /storage volume holds files that users choose to keep on the server, so give it the same backup and retention rules as any file share.
BentoPDF: the server never sees the document
BentoPDF takes the opposite approach. It is a client-side toolkit: your server delivers HTML, JavaScript and WebAssembly, and the PDF is processed inside the visitor's browser. Nothing is uploaded, so a compromised server holds no past documents, and there are no accounts, temp folders or upload limits to manage. It is dual-licensed under AGPL-3.0 or a commercial license.
services:
bentopdf:
image: ghcr.io/alam00000/bentopdf-simple:latest
container_name: bentopdf
restart: unless-stopped
ports:
- "127.0.0.1:3000:8080"
Add a second site block to the Caddyfile that proxies to 127.0.0.1:3000. Two details matter before you announce it to a team:
- External downloads. BentoPDF does not bundle its AGPL processing libraries (PyMuPDF, Ghostscript and CoherentPDF compiled to WebAssembly). By default, browsers fetch them at runtime from the jsDelivr CDN. For an offline or air-gapped network, build the image with your own URLs through the
VITE_WASM_PYMUPDF_URL,VITE_WASM_GS_URLandVITE_WASM_CPDF_URLbuild arguments, and serve those files from the same origin as the app. - HTTPS and hardware. Office document conversion needs a secure context, so a bare LAN address over plain HTTP will not do. And since the work happens on the client, a long scanned file is limited by the user's laptop, not by your server.
Command-line tools for scripts
For recurring jobs, a web interface gets in the way. These packages are in the Debian and Ubuntu repositories and fit cron jobs, CI runners and queue workers:
| Tool | License | Use it to |
|---|---|---|
| qpdf | Apache-2.0 | Merge, select pages, encrypt, linearize for fast web viewing |
| OCRmyPDF | MPL-2.0 | Add a searchable text layer to scans, using Tesseract and Ghostscript |
| Ghostscript | AGPL-3.0, or commercial from Artifex | Rewrite and compress, render pages |
| poppler-utils | GPL | Read metadata, extract text, convert pages to images |
sudo apt install -y qpdf ocrmypdf ghostscript poppler-utils
# Merge two files, then keep pages 1-3 and the last page of a report
qpdf --empty --pages contract.pdf annex.pdf -- merged.pdf
qpdf --empty --pages report.pdf 1-3,r1 -- summary.pdf
# AES-256 encryption (the keyword form needs qpdf 11.7.0 or later)
qpdf merged.pdf locked.pdf --encrypt --user-password='open-me' \
--owner-password='owner-secret' --bits=256 --
# Searchable scan: 4 pages in parallel, pages that already have text are left alone
ocrmypdf -l eng --skip-text --jobs 4 scan.pdf scan-ocr.pdf
# Smaller file for email
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -dQUIET \
-sOutputFile=small.pdf big.pdf
# Inspect and extract
pdfinfo scan-ocr.pdf
pdftotext -layout scan-ocr.pdf scan.txt
Each extra OCR language needs its Tesseract pack, such as tesseract-ocr-fra for French. If you ship Ghostscript inside a product you sell, read the AGPL terms or buy the commercial license from Artifex before release.
The same jobs can run through Stirling's API when the files already live on another machine:
curl -X POST "https://pdf.example.com/api/v1/misc/compress-pdf" \
-H "X-API-KEY: $STIRLING_API_KEY" \
-F "fileInput=@invoice.pdf" \
-F "optimizeLevel=5" \
-o invoice-small.pdf
Size the server for OCR, not for merging
Merging, splitting and rotating are light work. OCR is not: every page is rendered to an image and analyzed, and OCRmyPDF spreads pages across cores with --jobs. More vCPUs shorten a big batch; more RAM mostly helps when several people convert at once.
- Browser-side only: the smallest plan is enough, because the server only sends static files.
- Stirling-PDF standard image: 4 GB, the project's own suggestion.
- Heavy OCR or the fat image: 4 vCPUs and 8 GB or more.
On CloudSat, Stirling-PDF and BentoPDF are one-click apps, and the 4 GB Cloud VPS at $11.58/mo matches Stirling's standard memory suggestion.
Treat processed files as data you hold
A server-side PDF tool briefly holds every document it touches, and sometimes keeps it. Before you invite the team:
- Keep login on, and connect OIDC if you already run an identity provider.
- Bind containers to
127.0.0.1and open only 80 and 443 to the internet. - Back up
/configs(settings, the built-in database and keys) and/storage, and encrypt the copies that leave the server. - In scripts, work in a folder created with
mktemp -dand delete it with atrapon exit, so failed runs leave no copies behind. - Update on a schedule. A PDF parser reads untrusted input all day.
FAQ
Is Stirling-PDF free for a team?
Up to 5 users on the free plan, with OAuth2 or OIDC sign-in included. Larger teams and SAML need a paid plan. An instance without login, such as the ultra-lite image, serves anyone who can reach it, so keep it on localhost or a VPN.
Can BentoPDF work without internet access?
Yes, with a custom build. Set the VITE_WASM_* build arguments to files hosted on the same origin as the app. The default image tells browsers to download those modules from jsDelivr when a tool first needs them.
Which tool suits a large archive of scans?
OCRmyPDF in a script. It skips the upload step, processes pages in parallel, and can run under nice so it does not slow other services. Keep Stirling or BentoPDF for the people who need a few files done by hand.
Can an automation tool call Stirling-PDF?
Yes. Any tool that sends a multipart POST with the X-API-KEY header can, including the engines in self-hosted workflow automation tools. Create a dedicated user for the integration so you can revoke its key without touching anyone else.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




