{"id":19723610,"url":"https://github.com/leechy/capacitor-cyrillic-ocr","last_synced_at":"2025-10-13T01:03:42.433Z","repository":{"id":70751151,"uuid":"603165513","full_name":"leechy/capacitor-cyrillic-ocr","owner":"leechy","description":"On-device OCR plugin with Cyrillic support for Capacitor.js","archived":false,"fork":false,"pushed_at":"2023-03-14T14:56:59.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-18T05:30:34.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leechy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-17T18:54:19.000Z","updated_at":"2024-11-18T15:08:41.000Z","dependencies_parsed_at":"2023-04-10T15:31:12.160Z","dependency_job_id":null,"html_url":"https://github.com/leechy/capacitor-cyrillic-ocr","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"68ca7977606d93759919635eba16e579177b3729"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leechy/capacitor-cyrillic-ocr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fcapacitor-cyrillic-ocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fcapacitor-cyrillic-ocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fcapacitor-cyrillic-ocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fcapacitor-cyrillic-ocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leechy","download_url":"https://codeload.github.com/leechy/capacitor-cyrillic-ocr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leechy%2Fcapacitor-cyrillic-ocr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013885,"owners_count":26085325,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T23:22:53.332Z","updated_at":"2025-10-13T01:03:42.396Z","avatar_url":"https://github.com/leechy.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# capacitor-cyrillic-ocr\n\nOCR plugin with Cyrillic support (MLKit Vision on iOS and Tesseract4Android)\n\nI was using amazing Capacitor plugin @pantrist/capacitor-plugin-ml-kit-text-recognition. It's based on Google's MLKit and it works great. But after a while realized, that it doesn't support any of the Cyrillic languages. So I decided to create new plugin based on Tesseract for Android and MLKit Vision for iOS.\n\nUse this plugin only if you need support for languages and scripts that are not supported by the Google MLKit. I am not planning to maintain it much more than it's needed for my Capacitor app.\n\n## Install\n\n```bash\nnpm install capacitor-cyrillic-ocr\nnpx cap sync\n```\n\n## iOS\n\nYou don't have to do anything for iOS.\n\n## Android\n\n### Tesseract Trained Data files\n\nFor the Android, you will need to have the Tesseract language files in the Data directory of your app in a folder called `tessdata`. You can download them from [here](https://github.com/tesseract-ocr/tessdata/tree/4.0.0) and add them to the filesystem before using the plugin.\n\nSince the files can be quite big, the best way is to download them and save them after the app is installed. On the first run, for example.\n\nAnother issue I had with the file sizes, especially English dictionary is that it’s too big to be handled by the official Capacitor Filesystem plugin. Android application crashes with Out of memory error. I can recommend to use [Capacitor Blob Writer](https://www.npmjs.com/package/capacitor-blob-writer) plugin which is working correctly for me.\n\n```typescript\nimport write_blob from 'capacitor-blob-writer';\n\n...\n\nconst file = await fetch(\n  'https://raw.githubusercontent.com/tesseract-ocr/tessdata/master/eng.traineddata',\n);\nif (file) {\n  await write_blob({\n    path: '/tessdata/eng.traineddata',\n    blob: file.blob(),\n    directory: Directory.Data,\n    fast_mode: true,\n  });\n} else {\n  alert('Could not download OCR library file ' + filesToDownload[i]);\n}\n```\n\n### Repository\n\nTo install properly Tessaract4Android libraries, it is needed to add the following repository to your `/android/app/build.gradle` file:\n\n```gradle\nrepositories {\n    ...\n    maven { url 'https://jitpack.io' }\n}\n```\n\nAnd... that should be enough. If you have any issues, please let me know.\n\n## Usage\n\nTo retrieve the text from an image, you need to pass the image as base64 string to the plugin.\n\nLet’s say, you have an image somewhere in the filesystem.\nYou can use Capacitor’s Filesystem plugin to read it as base64 string.\nThen you should pass it to the plugin, along with the languages you want to recognize as an array of strings.\nLanguages are a three-letter ISO language codes, you can get from [here](https://en.wikipedia.org/wiki/ISO_639-2). For example, for Bulgarian it’s `bul`, for English it’s `eng`.\n\n`orientation` is optional (default is 'up', and yet not sure it will be supported in Android, maybe will be removed in future)\n\n```typescript\nimport { CapacitorOCR } from 'capacitor-cyrillic-ocr';\nimport { Filesystem } from '@capacitor/filesystem';\n\n...\n\nconst fileData64 = await Filesystem.readFile({ path: 'path/to/file.jpg' });\nconst result = await CapacitorOCR.recognize({\n  base64Image: fileData64.data,\n  orientation: 'up',\n  languages: ['bul', 'eng'],\n});\n\nconsole.log(result);\n```\n\n## API\n\n\u003cdocgen-index\u003e\n\n* [`recognize(...)`](#recognize)\n* [Interfaces](#interfaces)\n\n\u003c/docgen-index\u003e\n\n\u003cdocgen-api\u003e\n\u003c!--Update the source file JSDoc comments and rerun docgen to update the docs below--\u003e\n\n### recognize(...)\n\n```typescript\nrecognize(options: CapacitorOCROptions) =\u003e Promise\u003cCapacitorOCRResult[]\u003e\n```\n\n| Param         | Type                                                                |\n| ------------- | ------------------------------------------------------------------- |\n| **`options`** | \u003ccode\u003e\u003ca href=\"#capacitorocroptions\"\u003eCapacitorOCROptions\u003c/a\u003e\u003c/code\u003e |\n\n**Returns:** \u003ccode\u003ePromise\u0026lt;CapacitorOCRResult[]\u0026gt;\u003c/code\u003e\n\n--------------------\n\n\n### Interfaces\n\n\n#### CapacitorOCRResult\n\n| Prop             | Type                            |\n| ---------------- | ------------------------------- |\n| **`text`**       | \u003ccode\u003estring\u003c/code\u003e             |\n| **`lines`**      | \u003ccode\u003eCapacitorOCRLine[]\u003c/code\u003e |\n| **`confidence`** | \u003ccode\u003enumber\u003c/code\u003e             |\n\n\n#### CapacitorOCRLine\n\n| Prop             | Type                                                          |\n| ---------------- | ------------------------------------------------------------- |\n| **`text`**       | \u003ccode\u003estring\u003c/code\u003e                                           |\n| **`bbox`**       | \u003ccode\u003e\u003ca href=\"#capacitorocrbbox\"\u003eCapacitorOCRBBox\u003c/a\u003e\u003c/code\u003e |\n| **`words`**      | \u003ccode\u003eCapacitorOCRWord[]\u003c/code\u003e                               |\n| **`confidence`** | \u003ccode\u003enumber\u003c/code\u003e                                           |\n\n\n#### CapacitorOCRBBox\n\n| Prop     | Type                |\n| -------- | ------------------- |\n| **`x0`** | \u003ccode\u003enumber\u003c/code\u003e |\n| **`y0`** | \u003ccode\u003enumber\u003c/code\u003e |\n| **`x1`** | \u003ccode\u003enumber\u003c/code\u003e |\n| **`y1`** | \u003ccode\u003enumber\u003c/code\u003e |\n\n\n#### CapacitorOCRWord\n\n| Prop             | Type                                                          |\n| ---------------- | ------------------------------------------------------------- |\n| **`text`**       | \u003ccode\u003estring\u003c/code\u003e                                           |\n| **`bbox`**       | \u003ccode\u003e\u003ca href=\"#capacitorocrbbox\"\u003eCapacitorOCRBBox\u003c/a\u003e\u003c/code\u003e |\n| **`confidence`** | \u003ccode\u003enumber\u003c/code\u003e                                           |\n\n\n#### CapacitorOCROptions\n\n| Prop              | Type                                             |\n| ----------------- | ------------------------------------------------ |\n| **`base64Image`** | \u003ccode\u003estring\u003c/code\u003e                              |\n| **`orientation`** | \u003ccode\u003e'up' \\| 'down' \\| 'left' \\| 'right'\u003c/code\u003e |\n| **`languages`**   | \u003ccode\u003estring[]\u003c/code\u003e                            |\n\n\u003c/docgen-api\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleechy%2Fcapacitor-cyrillic-ocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleechy%2Fcapacitor-cyrillic-ocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleechy%2Fcapacitor-cyrillic-ocr/lists"}