# Tesseract.js (OCR) Links: [Home](../../../index.md) Wrapper for [Tesseract.js](https://tesseract.projectnaptha.com/) -- Optical Character Recognition (OCR) in the browser. Extracts text from images. ## Loading ```js Application.require("thirdparty/convert/image/ocr/tesseract").then(function (Tesseract) { // Tesseract is the global Tesseract.js object }); ``` ## Use Cases ### Extract text from an image ```js Application.require("thirdparty/convert/image/ocr/tesseract").then(function (Tesseract) { Tesseract.recognize(document.getElementById('receipt-image'), 'eng') .then(function (result) { console.log('Extracted text:', result.data.text); console.log('Confidence:', result.data.confidence, '%'); }); }); ``` ### OCR with progress tracking ```js Application.require("thirdparty/convert/image/ocr/tesseract").then(function (Tesseract) { var worker = Tesseract.createWorker({ logger: function (info) { if (info.status === 'recognizing text') { document.getElementById('progress').style.width = (info.progress * 100) + '%'; } } }); worker.load() .then(function () { return worker.loadLanguage('eng'); }) .then(function () { return worker.initialize('eng'); }) .then(function () { return worker.recognize(imageData); }) .then(function (result) { console.log(result.data.text); return worker.terminate(); }); }); ``` ### Extract text from a specific region ```js Application.require("thirdparty/convert/image/ocr/tesseract").then(function (Tesseract) { Tesseract.recognize(imageElement, 'eng', { rectangle: { top: 0, left: 0, width: 200, height: 50 } }).then(function (result) { console.log('Header text:', result.data.text); }); }); ``` ## Notes - First call downloads the Tesseract WASM binary and language data (~2 MB for English). - Supports 100+ languages via language packs. - Input can be: image element, canvas, file, Blob, or URL. - Reference: [tesseract.projectnaptha.com](https://tesseract.projectnaptha.com/)