Cloud-native use of Docker to deploy PDF multi-functional tool Stirling-PDF
1. Introduction to Stirling-PDF
1.1 Stirling-PDF Introduction
This is a powerful locally hosted PDF-based manipulation tool that uses Dorker and allows you to perform various operations on PDF files, such as splitting and merging, converting, reorganizing, adding images, rotating, compressing, and more. This locally hosted web application started as a 100% chat-making application and has grown to include a wide range of features to handle all your PDF needs.
1.2 Stirling-PDF function
- Fully interactive GUI for merging/splitting/rotating/moving PDFs and their pages.
- Merge multiple PDFs into one generated file.
- Split PDF into multiple files by specified page numbers or extract all pages into a single file.
- Reorganize PDF pages into a different order.
- Rotate PDF in 90 degree increments.
- Delete page.
- Multi-page layout (format PDF into multiple pages).
- Scale page content size by set %.
- Adjust contrast.
- Crop PDF.
- Automatically split PDFs (using physically scanned page separators).
- Extract the page.
- Convert PDF to single pages.
- Convert PDF to and from images.
- Convert any commonly used file to PDF (using LibreOffice).
- Convert PDF to Word/Powerpoint/Others (using LibreOffice).
- Convert HTML to PDF.
- URL pointing to the PDF.
- Price reduced for PDF.
2. This practice plan
2.1 Local environment planning
This practice is a personal test environment, and the operating system version is centos7.6.
hostname | IP address | Operating system version | Docker version |
---|---|---|---|
jeven | 192.168.3.166 | centos 7.6 | 20.10.17 |
2.2 Introduction to this practice
1. The deployment environment for this practice is a personal test environment, please be cautious in the production environment;
2. Deploy the PDF multi-function tool Stirling-PDF in the Docker environment.
3. Local environment inspection
3.1 Check Docker service status
Check whether the Docker service is running normally and ensure that Docker is running normally.
[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2023-09-28 07:36:35 CST; 11h ago
Docs: https://docs.docker.com
Main PID: 12113 (dockerd)
Tasks: 111
Memory: 273.2M
CGroup: /system.slice/docker.service
3.2 Check Docker version
Check Docker version
[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701
3.3 Check docker compose version
Check the Docker compose version to make sure it is above 2.0.
[[root@jeven ~]# docker compose version
Docker Compose version v2.19.1
4. Download the Stirling-PDF image
Download the Stirling-PDF image from docker hub.
[root@jeven ~]# docker pull frooodle/s-pdf:latest
latest: Pulling from frooodle/s-pdf
34df401c391c: Pull complete
8cdc2b53ba57: Pull complete
c6c65d966457: Pull complete
13099527500c: Pull complete
78c116fb88da: Pull complete
20082bfb7928: Pull complete
dba638f6fe9b: Pull complete
b29eea22753f: Pull complete
4f4fb700ef54: Pull complete
996d139ed6da: Pull complete
00bc26b259cc: Pull complete
Digest: sha256:e6e209f64eb7c8b783a8cc745e640e6ccc4530c459bfd66da813a4a134e4fdba
Status: Downloaded newer image for frooodle/s-pdf:latest
docker.io/frooodle/s-pdf:latest
5. Deploy Stirling-PDF
5.1 Create Stirling-PDF container
Use docker-cli to quickly create Stirling-PDF containers.
docker run -d \
-p 8380:8080 \
-v /data/stirling-pdf/data/:/usr/share/tesseract-ocr/4.00/tessdata \
-v /data/stirling-pdf/configs/:/configs \
-e DOCKER_ENABLE_SECURITY=false \
--name stirling-pdf \
frooodle/s-pdf:latest
5.2 View Stirling-PDF container status
Check the status of the tirling-PDF container to ensure that the Stirling-PDF container starts normally.
[root@jeven ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e2b79fbf50cc frooodle/s-pdf:latest "/scripts/init.sh ja…" 2 minutes ago Up 2 minutes 0.0.0.0:8380->8080/tcp, :::8380->8080/tcp stirling-pdf
5.3 View Stirling-PDF container logs
Check the Stirling-PDF container log to ensure that the Stirling-PDF service is running normally.
docker logs stirling-pdf
6. Access the PDF multi-function tool Stirling-PDF
6.1 Visit Stirling-PDF home page
Access address: http://192.168.3.166:8380/, replace the IP address with your own server IP address.
6.2 Set system Chinese
Click on the small "Earth" shaped icon as shown in the picture and click on Simplified Chinese.
7. Basic use of Stirling-PDF tool
7.1 Convert word document to PDF document
Click the Convert module in the menu bar and select the "Convert file to PDF file" option.
Select the file and click Convert to PDF.
After the conversion is successful, the browser will automatically download it locally.
7.2 Convert PDF to word
Click the conversion module in the menu bar and select "Convert PDF to Word".
Upload the file and click "Convert".
The PDF file will be converted into a word file and the browser will automatically download it locally.
Open the word file downloaded locally and browse the file contents.
7.3 Compare PDF documents
You can compare the previous modifications of two PDF documents.
7.4 Add watermark function
Go to Security - Add watermark, fill in the watermark content and confirm.
After the addition is successful, the browser downloads it locally, opens the document, and you can see the watermark effect.