Capacitor plugin for Optical Character Recognition (OCR).
It does in device text recognition.
On iOS it uses Vision framework provided by Apple.
On Android it uses mlkit provided by Google.
It has a dependency to com.google.mlkit:text-recognition
, default version is 16.0.1
, but can be configured with a textRecognitionVersion
variable in your variables.gradle file.
npm install @jcesarmobile/capacitor-ocr
npx cap sync
An example app is available in example-app folder.
process(options: { image: string; }) => Promise<RecognitionResults>
Process the text on the provided image. Only file urls (as the ones returned by Camera plugin) are supported at the moment.
Param | Type |
---|---|
options |
{ image: string; } |
Returns: Promise<RecognitionResults>
Prop | Type | Description | Since |
---|---|---|---|
results |
RecognitionResult[] |
List of recognized texts | 1.0.0 |
Prop | Type | Description | Since |
---|---|---|---|
text |
string |
The recognized text. | 1.0.0 |
confidence |
number |
The confidence of the recognized text. | 1.0.0 |