tesseract.js
tesseract.js copied to clipboard
How to package all the code
hello,
I want using tesseract.js 2.1.5 in a electron app, and I have a questions need help.
when I did not add config for createWorker, will get an error code :
for example Error: Cannot find module ' ... \worker-script\node\index.js'
when specifying a relative workerPath or use default http url, the path after splicing is wrong. so, I try to specify an absolute path, It ran successfully! but those modules will not be packaged and will not work on other computers, because other computers dnot have 100% same module.
How can I avoid this problem?
thanks, this my code:
//main process
let worker
if (!worker_is_ready) {
worker = createWorker({
// workerPath: './node_modules/tesseract.js/src/worker-script/node',
// workerPath: 'https://unpkg.com/[email protected]/dist/worker.min.js'
// workerPath: "D:/new el/vue-electron-ui/app/node_modules/tesseract.js/src/worker-script/node",
// langPath: path.join(__dirname,'tessdata'),
cacheMethod: 'readOnly',
gzip:false
});
await worker.load()
await worker.loadLanguage('eng');
await worker.initialize('eng');
await worker.setParameters({ tessedit_char_whitelist: '0123456789' });
worker_is_ready = true;
}
const { data: { text } } = await worker.recognize(image);
handle(text);
}
Why has none of the contributors responded to this?
Based on the lack of response to this and other user's issues, I wonder if this package being actively supported?
See this example.
https://github.com/Balearica/tesseract.js-electron