Initially, I was writing my own PDF functionality, and I had even completed the image-to-PDF conversion feature. However, I remembered Stirling-PDF, so I took a look and promptly installed it – it was much more convenient.

Since I happened to have an idle server with BT Panel installed, Stirling-PDF was sufficient.

First, I installed the Docker service in the background.

Once that was done, I could install the Stirling-PDF service.

Create the installation file: docker-compose.yml

mkdir -p /www/wwwroot/StirlingPDF && cd /www/wwwroot/StirlingPDF

Use your preferred path; I just placed it here because I saw another program in this folder.

Configure the installation file docker-compose.yml:

nano /www/wwwroot/StirlingPDF/docker-compose.yml

fill in:

version: '3.3'

services:
  stirling-pdf:
    image: stirlingtools/stirling-pdf:latest
    container_name: stirling-pdf
    ports:
      - '8088:8080'
    restart: unless-stopped
    volumes:
    - /www/wwwroot/StirlingPDF/trainingData:/usr/share/tessdata # Required for extra OCR languages
    - /www/wwwroot/StirlingPDF/extraConfigs:/configs
    - /www/wwwroot/StirlingPDF/customFiles:/customFiles/
    - /www/wwwroot/StirlingPDF/logs:/logs/
    - /www/wwwroot/StirlingPDF/pipeline:/pipeline/
    environment:
    - DOCKER_ENABLE_SECURITY=false
    - INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false

Do not use the official full example on mainland China servers, as network issues may prevent installation. Therefore, use this instead.

To prevent port conflicts, you can change the port to 8088. If there are no conflicts, the default 8080 is fine.

Navigate to the directory containing docker-compose.yml and begin installation:

cd /www/wwwroot/StirlingPDF
docker-compose up -d

Once the installation process is complete, then disable it.

docker compose down

You need to install the OCR package first, otherwise some conversion functions will not work.

apt install git -y
cd trainingData
rm -rf *
git clone https://github.com/tesseract-ocr/tessdata_fast.git /www/wwwroot/StirlingPDF/trainingData

This means deleting any possible content from the trainingData, and then installing the tesseract-ocr package.

After installation, open port 8088 on the server—basically, open the port for your program.

Then start the Docker service:

docker compose up -d

Now access: ip:8088 (your port)

You should then see the Stirling-PDF interface.

Other configuration:

Edit the Stirling-PDF configuration file:

nano /www/wwwroot/StirlingPDF/extraConfigs/settings.yml

The default language is changed to Chinese:

defaultLocale: zh_CN

Title and description configuration:

appName: 无忌PDF - 免费的PDF在线处理工具 # application's visible name
homeDescription: 免费的PDF多功能处理工具 # short description or tagline shown on the homepage
appNameNavbar: 无忌PDF # name displayed on the navigation bar

Modify it according to your own needs.

Save and then restart:

docker restart stirling-pdf
也可以:
docker compose down
docker compose up -d

Custom configuration:

Add your own HTML file to the StirlingPDF/customFiles folder to use it.

To update:

docker-compose pull
docker-compose up -d

That covers the basics:

You can refer to my setup: pdf.wujiit.com

Access using a domain proxy:

Create a website in BT Panel. Follow the normal website creation process up to the beginning, then modify the configuration file:

location / {
  proxy_pass http://127.0.0.1:8088/;       # 改成你的端口
  proxy_redirect off;
  proxy_set_header Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Real-IP $remote_addr;
}

Then you can access it via the domain name. To block access via IP address and port, configure the firewall port permissions on the server.

Reference:

https://docs.stirlingpdf.com/Installation/Docker%20Install

https://github.com/Stirling-Tools/Stirling-PDF/issues/2150