0

I'm trying to use the Ghost4j wrapper to convert .ps files to .pdf on macOS 10.12.6 (Sierra)

I have used the sample program found here: http://www.ghost4j.org/highlevelapisamples.html

I have included the all the ghost4j jars and add the ghostscript libraries on the build path.

But I am getting the following error:

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 Convert.main(Convert.java:25)
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)
... 2 more

Any suggestions?

Akshay Chopra
  • 161
  • 1
  • 2
  • 9

2 Answers2

1

Try running Ghostscript directly from the command line.

Error -100 is a 'fatal error', something went wrong, and we can't tell what. Can be out of memory, file permission problems, or invalid configuration (or trying to use a 32-bit library when a 64-bit version was expected).

I can't help at all with Ghost4J, which is why I suggest trying to reproduce the problem with Ghostscript itself. If you can do that, or you can get the transcript from stderr/stdout then I may be able to help more.

KenS
  • 30,202
  • 3
  • 34
  • 51
1

it may be a little old but here is my solution: you need to delete the instance at the end of conversion

Ghostscript.deleteInstance();
Nibra
  • 21
  • 3