JSPM

@jcesarmobile/capacitor-ocr

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 370
  • Score
    100M100P100Q105524F
  • License MIT

Capacitor plugin for Optical Character Recognition (OCR)

Package Exports

  • @jcesarmobile/capacitor-ocr
  • @jcesarmobile/capacitor-ocr/dist/esm/index.js
  • @jcesarmobile/capacitor-ocr/dist/plugin.cjs.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jcesarmobile/capacitor-ocr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@jcesarmobile/capacitor-ocr

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.

Install

npm install @jcesarmobile/capacitor-ocr
npx cap sync

Example

An example app is available in example-app folder.

API

process(...)

process(options: { image: string; }) => Promise<RecognitionResults>

Process the text on the provided image. Can be a file URL (returned by Camera plugin by using CameraResultType.Uri) or a base64 data URL (returned by Camera plugin by using CameraResultType.DataUrl).

Example: { image: 'file:///path/to/image.jpg' } { image: 'data:image/png;base64,iVBORw0KG...' }

Param Type
options { image: string; }

Returns: Promise<RecognitionResults>


Interfaces

RecognitionResults

Prop Type Description Since
results RecognitionResult[] List of recognized texts 0.0.1

RecognitionResult

Prop Type Description Since
text string The recognized text. 0.0.1
confidence number The confidence of the recognized text. 0.0.1