Open mananshah88 opened 6 years ago
GS can not be initialize, on production only you say? Everything installed and permissions set?
Thanks 4F2E4A2E, for the quick response. Yup... it seems everything installed perfect with proper permission.
By enabling debug mode, I can found following errors from my code...
0 [main] **INFO** org.ghost4j.Ghostscript - **Error**: /rangecheck in --setpagedevice--
1 [main] INFO org.ghost4j.Ghostscript - Operand stack:
1 [main] INFO org.ghost4j.Ghostscript - false --dict:1/1(L)-- --nostringval-- --dict:85/162(ro)(L)-- --dict:1/1(L)-- --dict:8/86(L)-- --dict:0/0(L)-- --nostringval-- --dict:3/3(L)-- true --nostringval-- %MediaDestination 0 DisablePageHandler true %MediaSource 0 --dict:8/86(L)-- --nostringval-- --nostringval-- 0 --nostringval-- false --nostringval--
1 [main] INFO org.ghost4j.Ghostscript - Execution stack:
2 [main] INFO org.ghost4j.Ghostscript - %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1977 1 3 %oparray_pop 1976 1 3 %oparray_pop 1960 1 3 %oparray_pop --nostringval-- --nostringval-- 1945 1 7 %oparray_pop --nostringval-- --nostringval-- --nostringval--
2 [main] INFO org.ghost4j.Ghostscript - Dictionary stack:
2 [main] INFO org.ghost4j.Ghostscript - --dict:1196/1684(ro)(G)-- --dict:1/20(G)-- --dict:83/200(L)-- --dict:83/200(L)-- --dict:132/256(ro)(G)-- --dict:283/300(ro)(G)-- --dict:26/32(L)--
2 [main] **INFO** org.ghost4j.Ghostscript - **Current allocation mode is local**
2 [main] **INFO** org.ghost4j.Ghostscript - **Last OS error: No such file or directory**
2 [main] **ERROR** org.ghost4j.Ghostscript - **GPL Ghostscript 9.18: Unrecoverable error, exit code 1**
Exception generated during pdf thumbnail processing.
org.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -100
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:365)
....
(OS: ubuntu 16)
Any ideas?? Do I need to set any PATH or any environment variable?
Thanks in advance.
What about the permission of the application you’re running?
It has same access level. 'sudo'
@mananshah88 Could you please let us know how you've enabled debug mode in Ghost4j? I am getting the same exception "Cannot initialize Ghostscript interpreter". But the Error code is -15 instead of -100. I am setting parameters for debugging but it doesn't seem to work. Thanks in advance.
@kvadlamani sorry its a very old thread. So i do not remember exactly.
But there are parameters like "-dPDFDEBUG, -dPDFWRDEBUG" which could help you.
There are others as well. You can get it from here: https://www.ghostscript.com/doc/current/Use.htm#Environment_variables (13. Debugging section)
@mananshah88 Thanks for the reply. Unfortunately, none of the debug options worked for me. This is the code I am trying to execute:
public static void main(String[] args) throws GhostscriptException {
final Ghostscript gs = Ghostscript.getInstance();
final String basePath = "/usr/local/downloads/";
final String fileName = "xyz";
final String[] gsArgs = getArgs(basePath, fileName);
gs.initialize(gsArgs);
}
private static String[] getArgs(String basePath, String fileName) {
final ArrayList<String> args = new ArrayList<String>();
args.add("-sDEVICE=pdfwrite");
args.add("-dPDFX");
args.add("-dBATCH");
args.add("-dNOPAUSE");
args.add("-dNOOUTERSAVE");
args.add("-sProcessColorModel=DeviceCMYK");
args.add("-dUsePDFX3Profile");
args.add("-sOutputFile=" + basePath + fileName + "-x1a.pdf");
args.add(basePath + "PDFX1A_def.ps");
args.add(basePath + fileName + ".pdf");
return args.toArray(new String[0]);
}
and I am getting the exception:
Exception in thread "main" org.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -15
at org.ghost4j.Ghostscript.initialize(Ghostscript.java:365)
at com.testing.DisplayCallbackExample.main(DisplayCallbackExample.java:24)
Hi, I am facing a weird problem. My code works on my machine but not on production. :D :D :D
Ghostscript: 9.18 (2015-10-05) Ghostscript4j : 1.0.1 jna: 4.1.0 ( all versions are same on local machine as well as on production.)
I am trying to create thumbnail from the PDF file.
Here is my code:
The error I got on my production is:
Can anyone gives me any direction?