Aspose.OCR for Java 21.12 - Release Notes

All Features

KeySummaryCategory
OCRJAVA-205Add .xlsx support for output formatEnhancement
OCRJAVA-198Searchable PDF output (with original text structure): input - imageEnhancement
OCRJAVA-200Consulting: Differences in .NET and Java versionBug

Enhancements

The next opportunities:

  • improved skew correction algorithm
  • added the ability to get an Excel document (.xlsx) as a result of recognition
  • added ability to get Searchable PDF and DOCX document with original text structure

Public API and Backwards Incompatible Changes

New API

  • added case to the Format enum: Xlsx

Removed APIs

  • none

Will be deprecated

  • none

Usage Example

import static java.lang.System.out;

import java.awt.Rectangle;
import java.io.IOException;

import com.aspose.ocr.AsposeOCR;
import com.aspose.ocr.DocumentRecognitionSettings;
import com.aspose.ocr.CharactersAllowedType;
import com.aspose.ocr.License;
import com.aspose.ocr.RecognitionResult;
import com.aspose.ocr.RecognitionResult.LinesResult;
import com.aspose.ocr.metered.Metered;


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

         // set license    

        License.setLicense("Aspose.Total.lic");
        boolean resLicense = License.isValid();
        out.println("License is :" + resLicense);


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

        String file= "image.png";		
		
	    // settings object 
		RecognitionSettings set = new RecognitionSettings();
		
		
		// Save result in Excel file
		RecognitionResult result = api.RecognizePage(file, set);	
		result.save("D://imgs/test/java_test.xlsx", format);
		

		// Save result in multipage Excel file
		ArrayList<String> files = new ArrayList<String>();
		files.add("img1.png");
		files.add("img2.jpg");
		ArrayList<RecognitionResult> results = api.RecognizeMultiplePages(files, set);	
		AsposeOCR.SaveMultipageDocument("java.xlsx", Format.Xlsx, results);
    }
}