naptha / tesseract.js

Pure Javascript OCR for more than 100 Languages 📖🎉🖥
http://tesseract.projectnaptha.com/
Apache License 2.0
34.91k stars 2.21k forks source link

5.0.4 Regarding the issue of compatibility app error "Blob is not defined" #879

Closed NovelForum closed 8 months ago

NovelForum commented 8 months ago

I have no problem using version 2.0.0 in Uniapp, but during component initialization, I need to copy the CDN from the local file to Plus.io, package the APK, and directly use the file from Plus.io in the APK. However, using the same method, I encountered an error message "ReferenceError: Blob is not defined" on 5.0.4, and the initialization of createWorker failed. May I ask what the problem is? Does 5.0.4 support apps?

![Uploading image.png…]()

Balearica commented 8 months ago

I am not familiar with the particular framework you are referring to. You should be able to use Tesseract.js within any project that runs on the browser or using Node.js v14 or higher.

The error message ReferenceError: Blob is not defined indicates the code is trying to create a Blob in a context where Blob is not defined. The most likely explanation is that you are trying to use the browser version of Tesseract.js (which uses blobs) within a project that uses Node.js (which does not have blobs). If you are using Node.js, you should be sure to use the Node.js version of Tesseract.js rather than the browser version. Examples of both can be found in the examples directory here.

NovelForum commented 8 months ago

Thank you very much for your reply. I have already resolved this issue.