Self Hosting 4 min read

Stirling-PDF: The Ultimate Self-Hosted PDF Tool (Docker Guide)

Suresh Suresh
Stirling-PDF: The Ultimate Self-Hosted PDF Tool (Docker Guide)

Are you tired of uploading sensitive PDF documents to free online services that store your data, or paying expensive subscriptions just to merge or split a few pages? Enter Stirling-PDF.

Stirling-PDF is a robust, open-source, and fully self-hosted web application that allows you to perform over 60 different operations on PDF files. Because it runs locally on your own hardware, no documents ever leave your infrastructure. Once a task is completed, the file is immediately wiped from the server memory, making it incredibly secure and private.

In this guide, we’ll explore the features of Stirling-PDF and show you exactly how to host it yourself using Docker.

Why Choose Stirling-PDF?

Before diving into the installation, let’s look at why Stirling-PDF has become a massive hit in the self-hosting community:

  1. Absolute Privacy: It does not make outbound network calls for processing. Your tax documents, medical records, and legal contracts stay on your server.
  2. Comprehensive Toolset: It offers over 60 tools, including merging, splitting, rotating, image extraction, and watermarking.
  3. Advanced OCR: Optical Character Recognition (OCR) is built-in, allowing you to turn scanned images into fully searchable and selectable text PDFs.
  4. File Conversions: Convert PDFs to and from Word, Excel, PowerPoint, and various image formats seamlessly.
  5. Security Tools: Add passwords, remove passwords, redact sensitive text, and add digital signatures to your documents.
  6. Developer API: It provides a REST API, so you can automate PDF processing inside your own scripts and applications.

Prerequisites

To follow this tutorial, you will need:

  • A server or machine running Linux (Ubuntu/Debian recommended).
  • Docker and Docker Compose installed on your machine. If you haven’t installed Docker yet, check out our Beginner’s Guide to Installing Docker.

Step 1: Create a Docker Compose File

The best and most persistent way to install Stirling-PDF is by using docker-compose. This allows us to easily map volumes and configure environment variables.

Create a new directory for Stirling-PDF and navigate into it:

mkdir -p ~/stirling-pdf
cd ~/stirling-pdf

Next, create a docker-compose.yml file using your favorite text editor (like nano):

nano docker-compose.yml

Paste the following configuration into the file:

version: '3.3'
services:
  stirling-pdf:
    image: frooodle/s-pdf:latest
    container_name: stirling-pdf
    ports:
      - "8080:8080"
    volumes:
      - ./trainingData:/usr/share/tesseract-ocr/4.00/tessdata # For OCR languages
      - ./extraConfigs:/configs
      - ./customFiles:/customFiles/
    environment:
      - DOCKER_ENABLE_SECURITY=false
      - INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false
      - LANGS=en_US
    restart: unless-stopped

Understanding the Configuration:

  • ports: Maps port 8080 on your host to port 8080 in the container.
  • volumes: Maps local directories to store OCR language training data and custom configurations, ensuring they aren’t lost if the container restarts.
  • environment: Sets basic configurations. You can change LANGS if you need OCR support for languages other than English.

Save and exit the file (in nano, press CTRL+X, then Y, then Enter).

Step 2: Start the Stirling-PDF Container

With your docker-compose.yml file in place, you can now spin up the application. Run the following command in the same directory:

docker compose up -d

The -d flag runs the container in “detached” mode, meaning it will run in the background. Docker will now download the Stirling-PDF image and start the server. This might take a few minutes depending on your internet connection.

Step 3: Access the Web Interface

Once the container is running, open your web browser and navigate to:

http://YOUR_SERVER_IP:8080

(If you are running this on your local machine, navigate to http://localhost:8080)

You will immediately be greeted by the Stirling-PDF dashboard, showcasing a clean grid of all available PDF tools.

Step 4: Add More Languages for OCR (Optional)

By default, Stirling-PDF comes with English OCR capabilities. If you need to scan documents in other languages (like Spanish, French, or German), you need to download the Tesseract training data for those languages.

  1. Download the .traineddata file for your desired language from the official Tesseract GitHub repository.
  2. Place the downloaded file into the ./trainingData directory we created alongside your docker-compose.yml file.
  3. Restart the container using docker compose restart.

Conclusion

Congratulations! You now have a powerful, completely private, self-hosted PDF management tool at your fingertips. Stirling-PDF eliminates the need to rely on paid or privacy-invasive online PDF editors.

Because you are running it in Docker, updating the software in the future is as easy as pulling the latest image and restarting your container:

docker compose pull
docker compose up -d

Happy self-hosting! If you found this tutorial helpful, be sure to explore our other Self-Hosting guides to take back control of your data.

Suresh

Written by Suresh

A passionate technology enthusiast, blogger, and self-taught developer. I write about Linux, Open Source, Cloud Computing, and emerging technologies to help students and beginners learn tech for free.

Discussion

Loading comments...