vluzrmos / ocrwebservice
此包的最新版本(v0.0.2)没有可用的许可信息。
ocrwebservice.com 的包装器
v0.0.2
2016-03-29 18:33 UTC
Requires
- guzzlehttp/guzzle: ~5.3|~6.0
This package is auto-updated.
Last update: 2024-09-13 05:48:14 UTC
README
此包是 http://www.ocrwebservice.com/api/restguide 的包装器。
安装
composer require vluzrmos/ocrwebservice
用法
您应该拥有一个具有试用版或其他订阅计划的账户才能使用此包。
获取账户信息
/* * 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; //...
处理文档
/* * 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 //...