There are three containers for self-hosted deployment provided by ComPDFKit for Linux to process PDFs on the server, including synchronous API, asynchronous API, and WebViewer. If you don’t know which suits your situation, learn the differences between synchronous, asynchronous API, and WebViewer.
Follow the detailed instructions below to learn how to use our asynchronous API to deploy ComPDFKit for Linux on your server with Docker.
Server Configuration
- Operating System Version: Ubuntu 22.04.3 LTS
- CPU: 8vCPU
- RAM: 16G
- Disk Storage: 50G
- Docker Version: Docker version 20.10.25, build 20.10.25-0ubuntu1~20.04.2
- docker-compose version: 1.25.0
Before starting ComPDFKit self-hosted deployment, please download the ComPDFKit self-hosted deployment mirror image for the asynchronous API on dockerhub.
The Process of Deploying ComPDFKit for Linux
Step 1. Place docker-compose.yml and compdfkit.sql into the fold where your server executes commands.
Step 2. Modify COMPDFKIT_SERVER_ADDRESS in docker-compose.yml to the IP address of your server.
Step 3. After modifying, execute the command: docker-compose up.
Step 4. Wait for the execution to complete, and you will see the following information:
“Running ComPDFKit Processor version 1.4.1. port(s) 7000 (http)”
Step 5. Open a new window (using Xshell as an example) and run the command: docker ps -a. Once it outputs as the below image, it indicates that you have successfully deployed ComPDFKit for Linux.
Verify If ComPDFKit for Linux Works Properly
Example Feature: PDF Conversion (Curl)
Step 1. Upload your PDF document to the server. Here the file “test.pdf” is placed in the same directory as compdfkit.sql.
Step 2. Run the following curl command:
curl -f -X POST http://your own server IP:17000/file/handle \
-H "Content-Type: multipart/form-data" \
-F file=@"test.pdf" \
-F executeType="pdf/json" \
-F password="file open password" \
-F parameter="{ \"type\": \"2\", \"isAllowOcr\": \"1\"}" \
Once the Interface execution finishes, the following response is given:
{"code":"200","msg":"success","data":{"fileId":"114ce116fa2083cc48d03573df0d1b71","fileLocalPath":"/tmp/compdfkit/temp-1852162645232219744-044870478.pdf","fileLocalPaths":null}}
Step 3. Run the below command to get the converted file result.
curl 'http://your own server IP:17000/file/getFileInfo?fileId=114ce116fa2083cc48d03573df0d1b71' \> result.zip
Result.zip is the output file after completing the conversion.
PS: If your file is too large, it needs to be listened to in real-time until successfully converted.
If you have any other questions about ComPDFKit for Linux, please contact our technical support team for further assistance.