Get Started
Plugins
Macros
More information

OCR

Description

Connects the TesseractJS-Core library for extracting text from an image (.png .jpg) and inserting it into the document.

Plugin type: visual, non-system.

Supported editors: documents, spreadsheets, presentations.

OCR
Installation

Available by default in the cloud, on-premises and desktop versions of ONLYOFFICE editors.

You can remove it following the desktop, on-premises, or cloud installation instructions.

The plugin guid: {440EBF13-9B19-4BD8-8621-05200E58140B}.

Usage
  1. Find the plugin on the Plugins tab.
  2. Click the Load File buttonand select an image.
  3. Choose the recognition language from the Choose Language pull-down menu.
  4. Click the Recognize button. The text will appear to the right of the picture.
  5. Clickthe Insert text button and the text will be inserted into the document at the text cursor position.
Plugin structure

Repository on GitHub: https://github.com/ONLYOFFICE/plugin-ocr.

  1. config.json, index.html and code.js
  2. Icons
  3. The translations folder contains translations into Russian, German, Spanish, Czech and French.
  4. index_about.html for the plugin About window
  5. Third-party services:
    • jQuery - a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development (http://jquery.com/). License: MIT License/.
    • TesseractJS-Core is a pure Javascript port of the popularTesseract OCR engine. This library supportsmore than 100 languages, automatic textorientation and script detection, a simple interface for reading paragraph, word, and characterbounding boxes (https://tesseract.projectnaptha.com/). License: Apache License.
Config
{
    "name": "OCR",
    "nameLocale": {
        "ru": "Распознавание текста",
        "fr": "Reconnaissance optique de caractères",
        "es": "Reconocimiento óptico de caracteres",
        "de": "OCR"
    },
    "guid": "asc.{440EBF13-9B19-4BD8-8621-05200E58140B}",
    "baseUrl": "",

    "variations": [
        {
            "description": "OCR",
            "descriptionLocale": {
                "ru": "Распознавание текста",
                "fr": "Reconnaissance optique de caractères",
                "es": "Reconocimiento óptico de caracteres",
                "de": "OCR"
            },
            "url": "index.html",

            "icons": [ "icon.png", "icon@2x.png", "icon2.png", "icon2@2x.png" ],
            "isViewer": false,
            "EditorsSupport": [ "word" ],

            "isVisual": true,
            "isModal": true,
            "isInsideMode": false,

            "initDataType": "none",
            "initData": "",

            "isUpdateOleOnResize": false,

            "buttons": [
                {
                    "text": "Insert Text",
                    "primary": true,
                    "textLocale": {
                        "ru": "Вставить текст",
                        "fr": "Insérer le texte",
                        "es": "Insertar texto",
                        "de": "Text einfügen"
                    }
                },
                {
                    "text": "Cancel",
                    "primary": false,
                    "textLocale": {
                        "ru": "Отмена",
                        "fr": "Annuler",
                        "es": "Cancelar",
                        "de": "Abbrechen"
                    }
                }
            ],

            "size": [ 592, 100 ]
        },
        {
            "description": "About",
            "descriptionLocale": {
                "ru": "Справка",
                "fr": "À propos",
                "es": "Sobre programa",
                "de": "Über"
            },
            "url": "index_about.html",

            "icons": [ "icon.png", "icon@2x.png", "icon2.png", "icon2@2x.png" ],
            "isViewer": false,
            "EditorsSupport": [ "word" ],

            "isVisual": true,
            "isModal": true,
            "isInsideMode": false,

            "initDataType": "none",
            "initData": "",

            "isUpdateOleOnResize": false,

            "buttons": [
                {
                    "text": "Ok",
                    "primary": true
                }
            ],

            "size": [ 392, 147 ]
        }
    ]
}
Methods and events

The main plugin code is located here.

Support

If you want to request a feature or report a bug regarding this plugin, use the issues section on GitHub.