├── LICENSE ├── README.md ├── docs └── demo.png ├── images └── tesseract.js.png ├── index.html ├── js ├── main.js ├── tesseract-core.wasm.js ├── tesseract.min.js ├── tesseract.min.js.map ├── worker.min.js └── worker.min.js.map ├── manifest.json ├── package-lock.json └── traineddata └── eng.traineddata.gz /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 jeromewu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tesseract.js-chrome-extension 2 | 3 | An example to use tesseract.js in chrome extension 4 | 5 |  6 | 7 | ## Install 8 | 9 | 1. Clone this repository: 10 | 11 | ``` 12 | $ git clone https://github.com/jeromewu/tesseract.js-chrome-extension.git 13 | ``` 14 | 15 | 2. Visit [chrome://extensions/](chrome://extensions/) 16 | 3. Click **Load unpacked** and choose the root of this repository 17 | 18 | ## Assets Download URL 19 | 20 | - js/tesseract.min.js: https://unpkg.com/tesseract.js@v2.0.0-alpha.9/dist/tesseract.min.js 21 | - js/tesseract.min.js.map: https://unpkg.com/tesseract.js@v2.0.0-alpha.9/dist/tesseract.min.js.map 22 | - js/worker.min.js: https://unpkg.com/tesseract.js@v2.0.0-alpha.9/dist/worker.min.js 23 | - js/worker.min.js.map: https://unpkg.com/tesseract.js@v2.0.0-alpha.9/dist/worker.min.js.map 24 | - js/tesseract-core.wasm.js: https://unpkg.com/tesseract.js-core@v2.0.0-beta.10/tesseract-core.wasm.js 25 | - traineddata/eng.traineddata.gz: http://tessdata.projectnaptha.com/4.0.0/eng.traineddata.gz 26 | -------------------------------------------------------------------------------- /docs/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeromewu/tesseract.js-chrome-extension/8fac10ad33812985e8a246c2916e6bf1747accc4/docs/demo.png -------------------------------------------------------------------------------- /images/tesseract.js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jeromewu/tesseract.js-chrome-extension/8fac10ad33812985e8a246c2916e6bf1747accc4/images/tesseract.js.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |OCR Result:
${text}
`; 18 | await worker.terminate(); 19 | } 20 | 21 | const startBtn = document.getElementById('start-btn'); 22 | startBtn.onclick = doOCR; 23 | -------------------------------------------------------------------------------- /js/tesseract.min.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Tesseract=t():e.Tesseract=t()}(window,function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=r(9),i=r(33),a=Object.prototype.toString;function c(e){return"[object Array]"===a.call(e)}function u(e){return null!==e&&"object"===n(e)}function s(e){return"[object Function]"===a.call(e)}function f(e,t){if(null!=e)if("object"!==n(e)&&(e=[e]),c(e))for(var r=0,o=e.length;rl&&(l=t[u]),t[u]>>16)>s&&n(Error("invalid code length: "+i)),t.j=o>>i,t.e=s-i,t.c=f,65535&r}function st(t){this.input=t,this.c=0,this.G=[],this.R=!1}function at(t){if("string"==typeof t){var e,r,n=t.split("");for(e=0,r=n.length;e