Copy link to clipboard
Copied
I am trying to implemet a REST Api in Spring Boot to OCR and compress my pdf files. The OCR operation is working fine, but when I try to compress them I get the following error:
java.lang.NoSuchMethodError: com.adobe.platform.operation.internal.api.CPFApi.cpfPredictApi(Lcom/adobe/platform/operation/internal/InternalExecutionContext;Lcom/adobe/platform/operation/internal/cpf/dto/request/ContentAnalyzerRequests;Ljava/util/List;Ljava/lang/Class;Ljava/lang/String;)Lcom/adobe/platform/operation/internal/http/HttpResponse;
I have these two dependencies in my pom:
<dependency> <groupId>com.adobe.documentcloud</groupId> <artifactId>dc-services-sdk</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>com.adobe.documentservices</groupId> <artifactId>pdftools-sdk</artifactId> <version>1.1.0</version> </dependency> </dependencies>
And through the developer console I've already added the PDF Embed API. What am I doing wrong?
Thank you in advance!
Copy link to clipboard
Copied
Can you share your code? Also, How does Embed API play a role in your solution?
Copy link to clipboard
Copied
I added the embed api through the dev console to be able to use the sdk in other projects, with private key and auth-json.
Copy link to clipboard
Copied
@darvasr
Firstly, the Credentials require PDF Tools API subscription and not PDF Embed API. Since OCR operation is working fine, the credentials have the PDF Tools API subscription.
Secondly, Compress operation was introduced in 1.1.0 version. The dependency of its previous version 1.0.0 with artifactId dc-services-sdk must be creating conflicts during class loading and thus, NoSuchMethodError is coming up. Please remove 1.0.0 version dependency and only keep following dependency in pom.xml:
<dependency> <groupId>com.adobe.documentservices</groupId> <artifactId>pdftools-sdk</artifactId> <version>1.1.0</version> </dependency>
Now, latest version is 1.2.0 and you can refer to its samples here: https://github.com/adobe/pdftools-java-sdk-samples