Browse our Products

Aspose.OCR for Java 21.4 - Release Notes

All Features

OCRJAVA-116Add the ability to set a threshold valueEnhancement
OCRJAVA-118Add .docx format for resultEnhancement


The next opportunities:

  • added ability to save the recognition result in the Microsoft Word Document format
  • added custom image quality correction with parameter ThresholdValue

Public API and Backwards Incompatible Changes


  • added enum Format to specify the document save format
  • modified method: public void save(string fullFileName, Format format) in the RecognitionSettings class
  • added method setThresholdValue(int) to influence pre-processing of images

Removed APIs

Will be deprecated

  • none

Usage Example

import static java.lang.System.out;

import java.awt.Rectangle;

import com.aspose.ocr.AsposeOCR;
import com.aspose.ocr.License;
import com.aspose.ocr.RecognitionResult;
import com.aspose.ocr.RecognitionSettings;
import com.aspose.ocr.SaveFormat.Format;

////  for gpu version

// import com.aspose.ocr.gpu.AsposeOCR;
// import com.aspose.ocr.gpu.License;
// import com.aspose.ocr.gpu.RecognitionResult;
// import com.aspose.ocr.gpu.RecognitionSettings;

public class App {
       public static void main(String[] args) {

        // set license    

        boolean resLicense = License.isValid();
        out.println("License is :" + resLicense);

        // Create api instance
        AsposeOCR api = new AsposeOCR();

        String img= "D:/img.png";		
        RecognitionSettings settings = new RecognitionSettings();
		RecognitionResult result = api.RecognizePage(file, settings);
		System.out.println(result.recognitionText);"testres.docx", Format.Docx);