我尝试在我的角度应用程序中导入“ Tesseract”库。 我做了这些步骤:
npm install tesseract.js --save
npm install @types/tesseract.js --save-dev
在我的服务中,我这样输入:
import * as Tesseract from 'tesseract.js';
import { Injectable } from '@angular/core';
@Injectable()
export class OcrService {
setNewImage(file) {
Tesseract.recognize(file)
.then(function (result) {
console.log(result)
})
}
}
但是我尝试运行setNewImage()
时收到下一个错误:
Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:4200/dist/worker.dev.js?nocache=u87pdjkghm' failed to load.
at blob:http://localhost:4200/23b6850f-cb9c-4673-a078-111b85405997:1:1
答案 0 :(得分:0)
此问题应在tesseract.js@1.0.16中修复,请安装并检查问题是否已解决。
感谢支持该库,现在我正在研究tesseract.js@2,感谢您的支持,它将在不久的将来发布。