Setting the OcrEngine to Automatically Detect the Reading Order in PHP

Aspose.OCR - Setting the OcrEngine to Automatically Detect the Reading Order

To Set the OcrEngine to Automatically Detect the Reading Order using Aspose.OCR Java for PHP, simply invoke DetectReading module. Here you can see example code.

PHP Code

## Initialize an instance of OcrEngine

$ocr_engine = new OcrEngine();

\# Set the Image property by loading the image from file path location

$imageStream=new ImageStream();

$ocr_engine->setImage($imageStream->fromFile($dataDir . 'ocr.png'));

\# Set the DetectReadingOrder to true

$ocr_engine->getConfig()->setDetectReadingOrder(true);

\# Process the image

if ($ocr_engine->process()) {

\# Display the result

print "Text: " . (string)$ocr_engine->getText().PHP_EOL;

}

Download Running Code

Download Setting the OcrEngine to Automatically Detect the Reading Order (Aspose.OCR) from any of the below mentioned social coding sites: