Building the API client library requires Maven to be installed.
To install the API client library to your local Maven repository, simply execute:
mvn installTo deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn deployRefer to the official documentation for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>com.sphereon.sdk</groupId>
<artifactId>pdf-sdk-java8-okhttp-gson</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>Add this dependency to your project's build file:
compile "com.sphereon.sdk:pdf-sdk-java8-okhttp-gson:1.1.0"At first generate the JAR by executing:
mvn package
Then manually install the following JARs:
- target/pdf-sdk-java8-okhttp-gson-1.1.1.jar
- target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
import com.sphereon.sdk.pdf.handler.*;
import com.sphereon.sdk.pdf.handler.auth.*;
import com.sphereon.sdk.pdf.model.*;
import com.sphereon.sdk.pdf.api.Conversion2PDFApi;
import java.io.File;
import java.util.*;
public class Conversion2PDFApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2schema
OAuth oauth2schema = (OAuth) defaultClient.getAuthentication("oauth2schema");
oauth2schema.setAccessToken("YOUR ACCESS TOKEN");
Conversion2PDFApi apiInstance = new Conversion2PDFApi();
String jobid = "jobid_example"; // String | jobid
File stream = new File("/path/to/file.txt"); // File | The (additional) binary image or PDF (file/inputstream) to convert to PDF
String fileName = "fileName_example"; // String | Optional input file name.
try {
ConversionJobResponse result = apiInstance.addInputFile(jobid, stream, fileName);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling Conversion2PDFApi#addInputFile");
e.printStackTrace();
}
}
}All URIs are relative to https://gw.api.cloud.sphereon.com/pdf/1.1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| Conversion2PDFApi | addInputFile | POST /conversion2pdf/jobs/{jobid}/streams/multipart | Upload a file |
| Conversion2PDFApi | addInputStreamLocations | POST /conversion2pdf/jobs/{jobid}/streams/location | Add Input Stream Location(s) |
| Conversion2PDFApi | createJob | POST /conversion2pdf/jobs | Create a PDF conversion job |
| Conversion2PDFApi | deleteJob | DELETE /conversion2pdf/jobs/{jobid} | Delete a job manually |
| Conversion2PDFApi | getJob | GET /conversion2pdf/jobs/{jobid} | Job definition and state |
| Conversion2PDFApi | getJobs | GET /conversion2pdf/jobs | Get all jobs |
| Conversion2PDFApi | getStream | GET /conversion2pdf/jobs/{jobid}/streams/result | Get the current result stream |
| Conversion2PDFApi | submitJob | PUT /conversion2pdf/jobs/{jobid} | Submit PDF job for processing |
- CSVSettings
- Compression
- ConversionJob
- ConversionJobResponse
- ConversionSettings
- ConversionTask
- ConversionTaskInput
- Error
- ErrorResponse
- InputResponse
- InputSettings
- Lifecycle
- ResultResponse
- ResultSettings
- StorageLocation
- StreamLocation
Authentication schemes defined for the API:
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- global: accessEverything
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.