zippy1978 / ghost4j

Java wrapper for Ghostscript C API + PS/PDF document handling API
http://www.ghost4j.org
GNU Lesser General Public License v3.0
64 stars 38 forks source link

Error while converting ps to pdf #46

Open peterprusi opened 8 years ago

peterprusi commented 8 years ago

Hi,

I am trying to convert ps to pdf. The high level example gives me this error :

0 [main] INFO org.ghost4j.Ghostscript - %%[ Error: undefined; OffendingCommand: load ]%% 2 [main] ERROR org.ghost4j.Ghostscript - GPL Ghostscript 9.10: Unrecoverable error, exit code 1 ERROR: org.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -100

Okay, so i tried the core api example and ended with this :

121 [main] INFO org.ghost4j.Ghostscript - %%[ ProductName: GPL Ghostscript ]%% 128 [main] INFO org.ghost4j.Ghostscript - %%[ Error: rangecheck; OffendingCommand: pdfmark ]%% 128 [main] ERROR org.ghost4j.Ghostscript - GPL Ghostscript 9.10: Unrecoverable error, exit code 1 ERROR: Cannot initialize Ghostscript interpreter. Error code is -100

If I execute this command in a shell, its working -> gs -ps2pdf -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=/tmp/test.pdf -c .setpdfwrite -f /tmp/pdf-sample.pdf.ps

I am using ghost4j 1.0, gs 9.10 and ubuntu 14.04 and here is my example file : http://workupload.com/file/w2G21VR5 With another ps file both api samples working. I dont know the problem and need some help.

Peter

4F2E4A2E commented 8 years ago

Hi there!

Can you please try to set a system link - like mentioned https://github.com/zippy1978/ghost4j/issues/37#issuecomment-189367005 - for gs?

cheers

peterprusi commented 8 years ago

Hi, the symlink for libgs.so is already set.

Peter

4F2E4A2E commented 8 years ago

I can't download you example file, pls try that project: https://github.com/zippy1978/ghost4j/files/148585/testGhost4jIssue37.zip

peterprusi commented 8 years ago

I tried that project with my file and it throws the same error :

Could not create a PDF using Ghost4J, here is the reason: 'org.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -100', please check the Stacktrace for more information. org.ghost4j.converter.ConverterException: org.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -100 at org.ghost4j.converter.PDFConverter.run(PDFConverter.java:251) at org.ghost4j.converter.AbstractRemoteConverter.convert(AbstractRemoteConverter.java:85) at TestPsTopdf.testPsToPDF(TestPsTopdf.java:28) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) Caused by: org.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -100 at org.ghost4j.Ghostscript.initialize(Ghostscript.java:365) at org.ghost4j.converter.PDFConverter.run(PDFConverter.java:231) ... 31 more