ComPDFKit API provides a variety of Java API tools that allow you to create an efficient document processing workflow in a single API call. Try our various APIs for free — no credit card required.
Programming Environment: Java JDK 1.8 and higher.
Dependencies: Maven.
Add the following dependency to your "pom.xml":
<dependency>
<groupId>com.compdf</groupId>
<artifactId>compdfkit-api-java</artifactId>
<version>1.3.2</version>
</dependency>
You can use your publicKey and secretKey to complete the authentication. You need to sign in your ComPDFKit API account to get your publicKey and secretKey at the dashboard. If you are new to ComPDFKit, click here to sign up for a free trial.
Project public Key : You can find the public key in Management Panel.
Project secret Key : You can find the secret Key in Management Panel.
CPDFClientclient = newCPDFClient(<publicKey>, <secretKey>);A task ID is automatically generated for you based on the type of PDF tool you choose. You can provide the callback notification URL. After the task processing is completed, we will notify you of the task result through the callback interface. You can perform other operations according to the request result, such as checking the status of the task, uploading files, starting the task, or downloading the result file.
// Create a clientCPDFClientclient = newCPDFClient(<publicKey>, <secretKey>);
// Create a task// Create an example of a PDF TO WORD taskCPDFCreateTaskResultresult = client.createTask(CPDFConversionEnum.PDF_TO_WORD.getValue());
// Get a task idStringtaskId = result.getTaskId();Upload the original file and bind the file to the task ID. The field parameter is used to pass the JSON string to set the processing parameters for the file. Each file will generate automatically a unique filekey. Please note that a maximum of five files can be uploaded for a task ID and no files can be uploaded for that task after it has started.
// Create a clientCPDFClientclient = newCPDFClient(<publicKey>, <secretKey>);
// Create a task// Create an example of a PDF TO WORD taskCPDFCreateTaskResultresult = client.createTask(CPDFConversionEnum.PDF_TO_WORD.getValue());
// Get a task idStringtaskId = result.getTaskId();
// Upload filesclient.uploadFile(<convertFile>, taskId);After the file upload is completed, call this interface with the task ID to process the files.
// Create a clientCPDFClientclient = newCPDFClient(<publicKey>, <secretKey>);
// Create a task// Create an example of a PDF TO WORD taskCPDFCreateTaskResultresult = client.createTask(CPDFConversionEnum.PDF_TO_WORD.getValue());
// Get a task idStringtaskId = result.getTaskId();
// Upload filesclient.uploadFile(<convertFile>, taskId);
// execute Taskclient.executeTask(taskId, CPDFLanguageConstant.English);Request task status and file-related meta data based on the task ID.
// Create a clientCPDFClientclient = newCPDFClient(<publicKey>, <secretKey>);
// Create a task// Create an example of a PDF TO WORD taskCPDFCreateTaskResultresult = client.createTask(CPDFConversionEnum.PDF_TO_WORD.getValue());
// Get a task idStringtaskId = result.getTaskId();
// Upload filesclient.uploadFile(<convertFile>, taskId);
// Execute Taskclient.executeTask(taskId, CPDFLanguageConstant.English);
// Query TaskInfoCPDFTaskInfoResulttaskInfo = client.getTaskInfo(taskId);See "Samples" folder in this folder.