Tutorials

On Premise Deploy ComPDFKit Processor on Your Businesses

By ComPDFKit | 2024 Jun 14
ComPDFKit Processor

 

At the recent Apple WWDC 2024, the integration of AI with its new generation of products was showcased, with most of each product's functionalities enhanced by AI or other features, resulting in a significant upgrade in user experience. While Apple provides these convenient functions to users, there are also concerns about the data security of personal devices.

 

When purchasing and using third-party technology, opting for On-Premise deployment can address most data security concerns. As a manufacturer of PDF document technology, we offer our clients various deployment options, including On-Premise deployment. This allows clients to handle confidential company PDF documents and other sensitive files on their own company devices, ensuring the data does not get transmitted to any third-party service platform.

 

This guide will walk you through how to host the ComPDFKit Processor PDF SDK on your own hardware to manage PDF viewing, editing, annotating, signing, filling, comparing, converting, and more.

 

Windows   Web   Android   iOS   Mac   Server   React Native   Flutter   Electron
30-day Free

 

 

Step1. Requirements for On-Premise Deployment

 

ComPDFKit Processor PDF SDK is a versatile solution that can be run across multiple platforms, supporting a variety of operating systems including:

 

  • Ubuntu, Fedora, Debian, and CentOS. Additionally, it is compatible with Ubuntu and Debian derivatives such as Kubuntu and Xubuntu. Please note that, at this time, only 64-bit Intel (x86_64) processors are supported.
  • Get the package of ComPDFKit Processor PDF SDK.
  • Contact sales to get a license. (You can also get 30-day trial license).

 

Whatever the operation systems you use. RAM should be more than 4GB.

 

 

Step 2. Docker Installation

 

ComPDFKit Processor PDF SDK is distributed in the form of Docker containers. To run it on your computer, you need to install the Docker for your operating system.

 

Please follow the instructions on the official Docker website to install and start Docker Engine. After installing Docker, you can use the installation instructions to install Docker Compose.

 

 

Step 3. Deploy ComPDFKit Processor On-Premise

 

ComPDFKit Processor PDF SDK requires a MySQL database for data storage. Therefore, you need to create and maintain a MySQL database to store the compdfkit.sql file for your on premise deployment.

 

To begin, register an account on Docker Hub and locate the ComPDFKit Processor images using the identifier compdfkit/compdfkit:tag. To get the latest ComPDFKit Processor images, execute the following command:

 

docker pull compdfkit/compdfkit:2.2.1

 

Ensure that the`docker-compose`is installed on your operating system. Go to Overview of installing Docker Compose | Docker Docs for detailed installation instructions.

 

First, you need to create a docker-compose.yml file. Edit the file via vim docker-compose.yml. Copy the following content into the docker-compose.yml file:

 

version: '3.3'
services:
  compdfkit_processor:
    restart: always
    image: compdfkit/compdfkit:2.2.1
    container_name: compdfkit_processor
    ports:
      - 7000:7000
    environment:
      LICENSE: your LICENSE_KEY
      DB_URL: dbmysql:3306/compdfkit
      DB_USERNAME: root
      DB_PASSWORD: mypassword
      # Temporary storage space for file processing
      TMP_PATH: /tmp/compdfkit
      # Language settings for Error messages. Support Chinese and English. (Default language is English)
      LANGUAGE: zh_cn
    depends_on:
      - dbmysql
  dbmysql:
    image: mysql:8.0.27
    restart: always
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --skip-character-set-client-handshake --skip-name-resolve --max_allowed_packet=500M --max_connections=1000 --default-authentication-plugin=mysql_native_password
    container_name: dbmysql
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: mypassword
      MYSQL_DATABASE: compdfkit
    volumes:
      - ./data:/var/lib/mysql
      - ./compdfkit.sql:/docker-entrypoint-initdb.d/compdfkit.sql

 

Put the "compdfkit.sql" file and the docker-compose.yml file you just created in one directory. Then, run the following command:

docker-compose up

 

Successfully deployed ComPDFKit Processor on premises when the following information appears:

Running ComPDFKit Processor version 2.2.1 port(s) 7000 (http)

 

ComPDFKit Processor also provides a simple web page that is primarily used to render PDF files and display them on a web page. You can directly process PDF files on the web page. You can access it through localhost:7000/index.html.

 

 

Step 4. On Premise API Configuration

 

After you deploy ComPDFKit Processor PDF SDK, some API configurations also need to be done:

 

Required API Configuration:

These should be configured. If not specified or incorrect, ComPDFKit Processor will not be able to be used.

 

  • LICENSE - This is the license key used to activate ComPDFKit Processor.
  • DB_URL - This is the database connection address, composed of <host>:<port>/<database name>.
  • DB_USERNAME - This is the username of the database connection.
  • DB_PASSWORD - This is the user password of the database connection.

  

Optional API Configuration:

Configure these APIs if you want.

 

  • SERVER_PORT - ComPDFKit Processor listening port. The default is `7000`.
  • TMP_PATH - Temporary storage space for loading temporary files. The default is `/tmp/compdfkit`.
  • LANGUAGE - Interface error description language zh_cn || en. The default language is en.
  • CONVERT_TIMEOUT - File processing timeout in minutes. The default is 15.

 

API Calling Example: PDF File Conversion

 

Now that everything is set up, you can begin using the ComPDFKit Processor PDF SDK to process PDFs. In this example, we'll demonstrate how to use the "PDF to Word Conversion" feature by calling the PDF to Word API. For more API references, please consult the ComPDFKit Processor PDF API reference:

  • Select the file you wish to process (e.g., document.pdf file).
  • Run the following command:

 

curl -f -X POST http://localhost:7000/file/handle \
-H "Content-Type: multipart/form-data" \
-F file=@"document.pdf" \
-F executeType="pdf/docx" \
-F password="file open password" \
> result.docx

 

public static void main(String[] args) throws IOException {
    OkHttpClient client = new OkHttpClient().newBuilder()
        .build();
    MediaType mediaType = MediaType.parse("text/plain");
    RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
        .addFormDataPart("file", "test.pdf",
                         RequestBody.create(MediaType.parse("application/octet-stream"),
                                            new File("test.pdf")))
        .addFormDataPart("executeType", "pdf/docx")
        .addFormDataPart("parameter", "{\"isContainAnnot\": \"1\",\"isContainImg\": \"1\",\"isFlowLayout\": \"1\" }")
        .build();
    Request request = new Request.Builder()
        .url("http://localhost:7000/file/handle")
        .method("POST", body)
        .build();
    Response response = client.newCall(request).execute();
    assert response.body() != null;
    IoUtil.copy(response.body().byteStream(), new FileOutputStream("result.docx"));
}

 

The converted result.docx file could be accessed. You can open the file in any Word Viewer.

 

 

Conclusion

 

By deploying the ComPDFKit Processor PDF SDK on your business's on-premise infrastructure, you ensure that your private PDF file data remains secure and unexposed, provided you do not share it with others. Additionally, ComPDFKit Processor offers powerful Document AI capabilities to extract and analyze PDF content, facilitating accurate PDF file conversion, translation, editing, table recognition, text extraction, text summarization, and more.

 

Windows   Web   Android   iOS   Mac   Server   React Native   Flutter   Electron
30-day Free