In using the sample code to call AsposeOCR.Recognize I Get NoSuchMethodError int com.aspose.pdf.Page.getRotate.
AsposeOCR api = new AsposeOCR();
RecognitionSettings recognitionSettings = new RecognitionSettings();|
OcrInput input = new OcrInput(InputType.PDF);|
input.add(PATH2PDF);|
ArrayList<RecognitionResult> result = api.Recognize(input, recognitionSettings);|
@dfplive
The NoSuchMethodError
you’re encountering, specifically for int com.aspose.pdf.Page.getRotate
, indicates a version mismatch between the Aspose libraries in your project. This error suggests that the method you’re trying to call does not exist in the version of the Aspose.PDF library currently included.
Cause: The error is likely due to using incompatible versions of Aspose.OCR and Aspose.PDF, or an outdated version of Aspose.PDF that does not support the method you are trying to use.
Solution: To resolve this issue, follow these steps:
-
Check Library Versions: Verify that you are using compatible versions of Aspose.OCR and Aspose.PDF. Refer to the release notes or documentation for any breaking changes or method deprecations.
-
Update Libraries: If your Aspose.PDF library is outdated, update it to the latest version. You can download the latest version from the Aspose website or use a package manager.
-
Clean and Rebuild: After updating, clean your project and rebuild it to ensure all references are correctly updated.
-
Check Dependencies: Ensure that all dependencies required by Aspose.OCR and Aspose.PDF are included and up to date.
-
Review Sample Code: If you are using sample code, confirm that it is compatible with the versions of the libraries you are using, as sample code may reference methods not available in older versions.
Next Steps: If you follow these steps and still encounter issues, please provide the versions of the libraries you are using, and I will assist you further.
Let me know if you need any more help!
Memo Style.pdf (27.1 KB)
Here is the test pdf that causes the issue
The versions of the API are
aspose-pdf-25.7-jdk17.jar
aspose-ocr-25.6.0.jar
I rolled back to Dec 2024 and the above code works
aspose-ocr-24.12.0
aspose-pdf-24.12-jdk17
@dfplive
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): OCRJAVA-437
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
As an update this issue first appears in Aspose.PDF for Java 25.1
Also it appears to be correct in aspose-ocr-24.12.0 but not in 25.1.0. You can use the modern version of PDF
@dfplive
Thanks for the information. This update has been taken into our account and we will inform you once the ticket is fully investigated and resolved.