electrontesseractelectron-buildernode-gyptesseract.js

How can I package an electron app with OCR features?


I built an electron app and ran into a situation where I need to add some OCR features. I figured out that people are mostly using tesseract.js but it's much slower than the native tesseract-ocr (factor or 10-20). That's why tesseract.js is no option for me. Alternatively I could just use one of the many tesseract node modules which are out there. In theory.

Problem: Those node modules require the compiled tesseract-ocr binaries (which are usually installed with apt or brew). I don't want my users to have to go through the extra setup hassle, I would rather like if I could just put everything into the electron installer.

Any ideas how I could get this done? I'm using electron-builder for packaging my app.


Solution

  • In the end I managed to get things working, with the help of a great dev mate. Here is node-native-ocr, and it works flawlessly with electron: https://www.npmjs.com/package/node-native-ocr