How to Deploy ComPDFKit On-premises with Docker (Asynchronous API)?

On-premises | Technical QuestionsThu. 26 Dec. 2024

There are three containers for on-premises provided by ComPDFKit Processor 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 Processor on your server with Docker. 

 

See also: How to deploy ComPDFKit Processor with Docker (Synchronous API)

 

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 to deploy ComPDFKit Processor, please download the mirror image of ComPDFKit Processor’s asynchronous API on dockerhub.


The Process of Deploying ComPDFKit Processor


Step 1. Place docker-compose.yml and compdfkit.sql into the fold where your server executes commands.

step1

 

Step 2. Modify COMPDFKIT_SERVER_ADDRESS in docker-compose.yml to the IP address of your server.

step2

 

Step 3. After modifying, execute the command: docker-compose up.

step3

 

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)”

step4

 

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 Processor.

step5

 

 

Verify If ComPDFKit Processor 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 Processor, please contact our technical support team for further assistance.