Every time you merge two invoices or redact a contract on a random website, those pages pass through someone else’s server. Most “free PDF tools” quietly keep a copy, train models on your data, or upsell you after three operations. If you handle anything confidential — client contracts, tax returns, medical records — that workflow is a liability.
Stirling PDF is an open-source, self-hosted web application that gives you 60+ PDF operations entirely on your own hardware. Merge, split, compress, OCR, sign, redact, convert, watermark, rotate — all through a clean browser UI, with zero data leaving your network.
This guide walks through a production Docker Compose deployment with authentication, OCR support, and a Caddy reverse proxy for HTTPS access.
What Stirling PDF actually does
Stirling PDF is a Java/Spring Boot application backed by Apache PDFBox, LibreOffice, and Tesseract. The Docker image bundles everything so you do not need to install Java or native libraries on the host.
Key capabilities:
- Merge and split — combine multiple PDFs or extract page ranges
- OCR — run Tesseract on scanned documents to make them searchable
- Convert — Word, Excel, PowerPoint, images, HTML to/from PDF
- Security — add/remove passwords, redact text, add watermarks, flatten forms
- Sign — draw or upload a signature and place it on any page
- Organize — rotate, reorder, remove pages, compress file size
- API — every operation has a REST endpoint for scripting and automation
The free self-hosted tier supports up to 5 users with all operations — no feature gating, no credits, no telemetry.
Prerequisites
| Requirement | Minimum |
|---|---|
| Docker + Compose | v24+ / v2.20+ |
| RAM | 1 GB (2 GB recommended for OCR) |
| Disk | 500 MB for images + working space |
| CPU | 1 core (2+ for concurrent OCR) |
If you are new to Docker, start with the Docker basics guide first.
Docker Compose setup
Create a project directory and the Compose file:
mkdir -p ~/stirling-pdf && cd ~/stirling-pdf
# docker-compose.yml
services:
stirling-pdf:
image: stirlingtools/stirling-pdf:0.46.1
container_name: stirling-pdf
ports:
- "127.0.0.1:8080:8080"
volumes:
- ./trainingData:/usr/share/tessdata
- ./configs:/configs
- ./customFiles:/customFiles
- ./logs:/logs
environment:
- DOCKER_ENABLE_SECURITY=true
- SECURITY_ENABLELOGIN=true
- SECURITY_INITIALLOGIN_USERNAME=admin
- SECURITY_INITIALLOGIN_PASSWORD=changeme-strong-password
- SYSTEM_DEFAULTLOCALE=en_US
restart: unless-stopped
Pin the image tag (here 0.46.1) rather than using latest — Stirling PDF ships breaking config changes between releases.
Bind to 127.0.0.1 so the app is only reachable through your reverse proxy, not directly from the internet.
Start the stack
docker compose up -d
docker compose logs -f stirling-pdf
Wait for the line Started StirlingPDF — first launch takes 30–60 seconds while the JVM warms up. Then open http://localhost:8080 and log in with the credentials you set above.
Change the default password immediately through Settings → Account after first login.
Adding OCR support
The base image includes Tesseract but ships without language data. Download the training files you need:
mkdir -p trainingData
# English
curl -L -o trainingData/eng.traineddata \
https://github.com/tesseract-ocr/tessdata_best/raw/main/eng.traineddata
# Vietnamese (add any language you need)
curl -L -o trainingData/vie.traineddata \
https://github.com/tesseract-ocr/tessdata_best/raw/main/vie.traineddata
Restart the container to pick up the new language packs:
docker compose restart stirling-pdf
Now the OCR page in the UI will list English and Vietnamese as available languages.
Reverse proxy with Caddy
If you already run Caddy, add a block for Stirling PDF:
pdf.yourdomain.com {
reverse_proxy 127.0.0.1:8080
}
Reload Caddy:
sudo systemctl reload caddy
Caddy handles HTTPS automatically via Let’s Encrypt. Your Stirling PDF instance is now available at https://pdf.yourdomain.com with a valid certificate.
Security hardening
Disable public registration
By default with SECURITY_ENABLELOGIN=true, only the initial admin account exists. To add users, log in as admin and create them through the admin panel. There is no open registration page.
Network isolation
Keep Stirling PDF on an internal Docker network if you run other services:
services:
stirling-pdf:
# ... existing config ...
networks:
- internal
networks:
internal:
driver: bridge
Rate limiting
If exposing to the internet, add rate limiting in your reverse proxy. In Caddy:
pdf.yourdomain.com {
rate_limit {
zone dynamic {
key {remote_host}
events 30
window 1m
}
}
reverse_proxy 127.0.0.1:8080
}
Using the API
Every UI operation has a matching REST endpoint. This is powerful for automation — process hundreds of PDFs from a script without clicking through the browser.
Merge two PDFs
curl -X POST "https://pdf.yourdomain.com/api/v1/general/merge-pdfs" \
-H "X-API-KEY: your-api-key" \
-F "[email protected]" \
-F "[email protected]" \
-o merged.pdf
OCR a scanned document
curl -X POST "https://pdf.yourdomain.com/api/v1/misc/ocr-pdf" \
-H "X-API-KEY: your-api-key" \
-F "[email protected]" \
-F "languages=eng" \
-F "ocrType=force-ocr" \
-o searchable.pdf
Compress a PDF
curl -X POST "https://pdf.yourdomain.com/api/v1/general/compress-pdf" \
-H "X-API-KEY: your-api-key" \
-F "[email protected]" \
-F "expectedOutputSize=1" \
-o compressed.pdf
Generate your API key from the admin panel under Settings → API Keys.
Integrating with n8n
If you run n8n for automation, Stirling PDF’s API turns it into a node in your workflow:
- Trigger — watch a folder or email for incoming PDFs
- HTTP Request node — POST to Stirling PDF’s API (OCR, merge, compress)
- Output — save the processed file, send it via email, or upload to Nextcloud
This is a real workflow: invoices arrive by email → n8n OCRs them through Stirling PDF → extracts text → saves to a shared folder. No cloud service involved.
Updating Stirling PDF
Check the releases page before updating — read the changelog for breaking changes.
cd ~/stirling-pdf
# Pull the new version (update the tag in docker-compose.yml first)
docker compose pull
docker compose up -d
# Verify
docker compose logs -f stirling-pdf
Your configs and training data persist in the mounted volumes, so updates do not lose settings.
Backup
Back up the configs/ directory and your docker-compose.yml. The training data can be re-downloaded, but custom settings, users, and API keys live in configs/.
tar czf stirling-backup-$(date +%Y%m%d).tar.gz \
configs/ customFiles/ docker-compose.yml
Stirling PDF vs cloud alternatives
| Feature | Stirling PDF | ILovePDF | Adobe Acrobat Online |
|---|---|---|---|
| Cost | Free (self-hosted) | Free tier limited | $12.99/mo |
| Data privacy | 100% local | Uploaded to servers | Uploaded to Adobe |
| Operations | 60+ | 25+ | 20+ |
| OCR | Yes (Tesseract) | Pro only | Yes |
| API | Full REST API | Paid tier | Paid tier |
| Offline use | Yes | No | No |
| User limit (free) | 5 | 1 | 1 |
For anyone handling sensitive documents, the privacy advantage alone justifies the 10 minutes of setup.
FAQ
How much RAM does Stirling PDF use?
Idle: ~300 MB. During heavy OCR on multi-page documents: 500 MB–1.5 GB. Allocate 2 GB to be safe with concurrent users.
Can I run it on a Raspberry Pi?
Yes, there is an ARM64 image. Performance is slower for OCR and LibreOffice conversions, but basic operations (merge, split, rotate) work fine.
Does it support batch processing?
Yes. The UI supports multi-file upload for most operations, and the API handles any volume you throw at it programmatically.
Is the free tier really unlimited?
The free self-hosted tier gives you all 60+ operations for up to 5 users. The paid “Pro” tier adds SSO, audit logs, and removes the user cap — most homelabs will never need it.
How do I reset the admin password?
Delete the configs/ directory and restart the container. It will recreate the initial admin account with the credentials from your environment variables.
Wrapping up
Stirling PDF replaces every sketchy online PDF tool with a single self-hosted application. The Docker setup takes under 10 minutes, the API opens up automation possibilities, and your documents never leave your network.
If you are building a homelab that handles real documents — invoices, contracts, tax forms — this belongs in your stack alongside Nextcloud and Vaultwarden.