GhostscriptException错误:无法初始化Ghostscript解释器。错误代码是-100

时间:2018-07-03 14:11:30

标签: java ghostscript

我正在使用Ghostscript api使用tess4j依赖项将pdf转换为tiff文件。操作系统是Windows。如果输入文件路径在PC本地,则转换工作正常。如果我将输入文件路径作为网络共享路径,则会出现上述错误。网络路径如下。 \ computername \ sharedfoldername。请帮忙。

Error:
GhostscriptException ERROR: Cannot initialize Ghostscript interpreter. Error code is -100

    try {
            synchronized (gs) {
                String[] gsArgs = new String[9];
                gsArgs[0] = "-gswin64";
                gsArgs[1] = "-q";
                gsArgs[2] = "-r300x300";
                gsArgs[3] = "-dNOPAUSE";
                gsArgs[4] = "-dBATCH";
                // gsArgs[5] = "-sDEVICE=tiffg4";
                // gsArgs[5] = "-sDEVICE=tiffgray";
                gsArgs[5] = "-sDEVICE=tiff24nc";
                gsArgs[6] = "-sCompression=lzw";
                gsArgs[7] = "-sOutputFile=" + OCR_OUTPUT_FOLDER + File.separator + tiffFile;
                gsArgs[8] = OCR_INPUT_FOLDER + File.separator + pdfFile;
                // execute and exit interpreter
                gs.initialize(gsArgs);
                gs.exit();
                opSuccess = "true";
            }
            System.out.println("Pdf to Tiff file generated successfully pdfFile = " + pdfFile + " tiffFile = " + tiffFile);
        } catch (GhostscriptException e) {
            opSuccess = "false";
            System.out.println("GhostscriptException ERROR: " + e.getMessage());
        } catch (Exception e) {
            opSuccess = "false";
            System.out.println("ERROR: " + e.getMessage());
        }

0 个答案:

没有答案
相关问题