Tag: ghost4j

无法使用Ghost4J加载库’gs’

我正在尝试使用Ghost4J将PDF转换为PNG。 我知道人们之前已经问过这个问题,但不是OS X 10以及最新版本的Ghost4J。 我已经按照zippy1978的答案中列出的说明进行操作: PDF到使用Java进行映像 我已经关注了Ghost4J页面中的所有内容 我也从这里尝试了两个答案: 我如何在OS X 10.9上使用ghost4j 我已经安装了Ghostscript和Port ,并尝试过Richard Koch的网站 。 我继续得到这个错误: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.UnsatisfiedLinkError: Unable to load library ‘gs’: dlopen(libgs.dylib, 9): image not found] with root cause java.lang.UnsatisfiedLinkError: Unable to load library ‘gs’: dlopen(libgs.dylib, 9): […]

Windows 64位上的Tess4j:multithreading上的exception

我在Windows 64位上使用tesseract 3和Java 8到OCR扫描的PDF。 我已按照Tess4j页面上的说明操作并使用了所需DLL的64位版本,并安装了64位Ghostscript。 当我使用正常的@Test(无参数)运行我的unit testing时, 代码运行正常 ,所以我想我已经正确安装了所有内容。 当我用2个并行线程运行它时(见下文)我得到一个例外。 我已经在这里阅读了相关的主题,但是建议使用我正在使用的Tesseract1(我已经尝试过)。 有任何想法吗? 这是代码: // @Test // works @Test(invocationCount = 2, threadPoolSize = 2) public void testOcr() throws OcrException, TesseractException { File scannedPdf = new File(this.getClass().getClassLoader().getResource(“scanned.pdf”).getFile()); // Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping String str […]

将PDF文件转换为图像

我想将PDF文档转换为图像。 我在使用Ghost4j。 问题: Ghost4J在运行时需要gsdll32.dll文件,我不想使用dll文件。 问题1:有没有办法,在ghost4j中转换图像而不用dll? 问题2:我在PDFBox API中找到了解决方案。 org.apache.pdfbox.pdmodel.PDPagep have method convertToImage()`,它将PDF页面转换为图像格式。 PDDocument doc = PDDocument.load(new File(“/document.pdf”)); Listpages = doc.getDocumentCatalog().getAllPages(); PDPage page = pages.get(0); BufferedImage image =page.convertToImage(); File outputfile = new File(“/image.png”); ImageIO.write(image, “png”, outputfile); doc.close(); 我在PDF文档上只有文字。 我运行此代码时遇到exception: Aug 12, 2013 6:00:24 PM org.apache.pdfbox.util.PDFStreamEngine processOperator INFO: unsupported/disabled operation: BDC Exception in thread “main” java.lang.ExceptionInInitializerError at org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.getawtFont(PDTrueTypeFont.java:481) […]