1

我试图让 tess4j 在一个简单的测试应用程序中工作以对 pdf 文件执行 OCR,但收到以下错误并且无法弄清楚如何解决它:

Exception in thread "main" java.lang.RuntimeException: Unable to load library 'gs': dlopen(libgs.dylib, 9): image not found
Please download, install GPL Ghostscript from http://sourceforge.net/projects/ghostscript/files and/or set the appropriate environment variable.
at net.sourceforge.vietocr.PdfUtilities.convertPdf2Tiff(Unknown Source)
at net.sourceforge.vietocr.ImageIOHelper.getIIOImageList(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at Test.main(Test.java:11)

我已经让 eclipse 打印出我看到的路径文件,它包含 /usr/loca/bin/gs (检查是否正确,使用 which gs),我可以愉快地从终端运行 gs。关于如何使它工作的任何想法?

代码显示在https://dl.dropboxusercontent.com/u/61920208/Screen%20Shot%202013-09-02%20at%2013.44.24.png的图像中

提前感谢您的帮助

4

1 回答 1

1

根据建议,重新安装 ghostsrcipt(通过端口而不是 dmg)为我解决了这个问题。

于 2013-09-04T06:54:59.737 回答