vluzrmos/ocrwebservice

There is no license information available for the latest version (v0.0.2) of this package.

A wrapper for ocrwebservice.com

v0.0.2 2016-03-29 18:33 UTC

This package is auto-updated.

Last update: 2024-04-13 04:46:17 UTC


README

This package is a wrapper for http://www.ocrwebservice.com/api/restguide.

Installation

composer require vluzrmos/ocrwebservice

Usage

You should have an account with a trial or other subscription plan to use that package.

Getting Account Information

/*
 * USERNAME and LICENSE_KEY are strings, and both are provided by ocrwebservice.com.
 */
$ocr = new OCRWebService\OCRWebService(USERNAME, LICENSE_KEY);
$account = $ocr->getAccountInformation();

/*
 Returns an object AccountInformation which has a method ->toArray():
 [                                                  
   "AvailablePages" => 22,                          
   "MaxPages" => 25,                                
   "ExpirationDate" => "04/29/2016",                
   "LastProcessingTime" => "3/29/2016 10:42:13 AM", 
   "SubcriptionPlan" => "TRIAL",                    
   "ErrorMessage" => "",                            
 ]                                                  
*/

$account->getAvailablePages();
$account->getMaxPages();
//...

$account->availablePages; //same of getAvailablePages() method;
//...

Processing a Document

/*
 * USERNAME and LICENSE_KEY are strings, and both are provided by ocrwebservice.com.
 */
$ocr = new OCRWebService\OCRWebService(USERNAME, LICENSE_KEY);

$document = $ocr->processDocument($pathToPdfOrImage, [
	'gettext' => 'true',
	'pagerange' => 'allpages',
	'language' => 'brazilian'
]);

//all options like described in http://www.ocrwebservice.com/api/restguide

// $document will be an instance of ProcessDocument, with that following methods:

$document->getOCRText(); //return ocr 
$document->toArray(); //return an array with all data 
//...