# Stirling PDF Tools

> Self-hosted PDF manipulation tool for merging, splitting, converting, and more.

- Category: Productivity & Collaboration
- Difficulty: beginner
- Components: stirling-pdf, nginx
- Tags: pdf, stirling, documents, conversion, tools
- Source: https://docker.recipes/productivity/stirling-pdf-tools

## Overview

Stirling PDF Tools is a powerful, self-hosted web application that provides comprehensive PDF manipulation capabilities without requiring users to upload sensitive documents to third-party services. Developed as a privacy-focused alternative to online PDF tools, Stirling PDF offers an extensive suite of features including document merging, splitting, rotation, watermarking, OCR processing, and format conversion. The application runs entirely within your infrastructure, ensuring complete data sovereignty and compliance with strict privacy requirements.

This deployment combines Stirling PDF with NGINX to create a production-ready document processing platform. NGINX serves as a reverse proxy, handling SSL termination, static file caching, and providing enhanced security features like rate limiting and request filtering. This architecture allows you to expose Stirling PDF to multiple users or teams while maintaining performance and security standards. The setup isolates PDF processing workloads behind NGINX's battle-tested web server capabilities.

This stack is ideal for organizations that regularly handle confidential documents, legal firms processing sensitive contracts, educational institutions managing student records, or any business requiring reliable PDF manipulation tools without cloud dependencies. Small businesses and home users will appreciate the comprehensive feature set that rivals expensive desktop applications, while enterprises benefit from the scalable, containerized deployment that integrates with existing infrastructure monitoring and backup systems.

## Features

- Complete PDF manipulation suite with merge, split, rotate, crop, and page extraction capabilities
- Advanced OCR processing using Tesseract with support for multiple languages and custom training data
- Format conversion between PDF, Word, Excel, PowerPoint, and various image formats
- Security features including password protection, digital signatures, and watermark application
- NGINX reverse proxy with SSL/TLS termination and HTTP/2 support for improved performance
- Batch processing capabilities for handling multiple documents simultaneously
- Image extraction and manipulation tools for extracting graphics from PDF documents
- Form filling and PDF annotation tools for interactive document processing

## Use cases

- Legal firms processing confidential contracts and court documents without cloud exposure
- Educational institutions batch-processing student transcripts and administrative documents
- Small businesses combining invoices, contracts, and reports for client deliverables
- Government agencies requiring air-gapped document processing for classified materials
- Healthcare organizations processing patient records while maintaining HIPAA compliance
- Real estate companies combining property documents, contracts, and disclosure forms
- Corporate document management for merging quarterly reports and financial statements

## Prerequisites

- Minimum 1GB RAM for basic PDF operations, 2GB+ recommended for OCR processing
- Docker and Docker Compose installed with sufficient storage for document processing
- Ports 80 and 443 available for NGINX web server access
- Understanding of NGINX configuration for SSL certificate setup and custom domains
- Basic knowledge of PDF processing workflows and document security requirements

## docker-compose.yml

```yaml
services:
  stirling-pdf:
    image: frooodle/s-pdf:latest
    ports:
      - "8080:8080"
    volumes:
      - stirling_training:/usr/share/tessdata
      - stirling_configs:/configs
      - stirling_logs:/logs
    environment:
      DOCKER_ENABLE_SECURITY: "false"
    networks:
      - stirling-net
    restart: unless-stopped

  nginx:
    image: nginx:alpine
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
    depends_on:
      - stirling-pdf
    networks:
      - stirling-net
    restart: unless-stopped

volumes:
  stirling_training:
  stirling_configs:
  stirling_logs:

networks:
  stirling-net:
    driver: bridge
```

## .env

```bash
# Stirling PDF Configuration
DOCKER_ENABLE_SECURITY=false
```

## Usage notes

- Web UI at http://localhost:8080
- Merge, split, rotate, watermark PDFs
- OCR and image extraction
- No data leaves your server

## Troubleshooting

- OCR processing fails with 'Tesseract not found': Ensure stirling_training volume is properly mounted and Tesseract language packs are downloaded
- Large PDF uploads timeout: Increase NGINX client_max_body_size directive and proxy timeout values in nginx.conf
- Memory errors during PDF processing: Increase container memory limits and ensure sufficient host system RAM
- NGINX 502 Bad Gateway errors: Verify stirling-pdf container is running and accessible on port 8080 within the Docker network
- PDF conversion fails for Office documents: Check that LibreOffice components are properly installed in the stirling-pdf container

