Skip to content
ComPDF
DemoSampleAPI ReferenceFAQ
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

How to Use ComPDFKit PDF SDK for Java in Java Applications

This section will help you to quickly get started with ComPDFKit PDF SDK to make a Java application with step-by-step instructions.

Create a New Project

  1. Create a Java application using the IDE. Here we create a new Java project.

create-project

Add the Package of ComPDFKit PDF SDK for Java

  1. The first thing we need to do is to import ComPDFKit PDF SDK for Java. Copy "lib" to the project.

copy-libs

  1. Right click on the SDK and select Add as Library....

    add-lib

  2. Add the following code to Main.java:

    java
    static{
        try {
           NativeKMPDFKit.initialize("your license", "your deviceId", "", Constants.LIB_DIR_NAME);
        } catch (FileNotFoundException e) {
              throw new RuntimeException(e);
        }
    }
  3. Start the main method to print out the information of your computer's system version. If the information is printed successfully, you have integrated ComPDFKit PDF SDK for Java successfully!

    result

Troubleshooting

  1. Problems

    If you meet some other problems when integrating our ComPDFKit PDF SDK for Java, feel free to contact ComPDFKit team.