I am using Ubuntu 10.10 amd64, Sun JDK 6.0.24 and the default ghostscript package. Now, I am trying to get the "Render a PDF document using SimpleRenderer" sample from the Ghost4J page working.
While the "List fonts of a PDF document using FontAnalyzer" example is working, the SimpleRenderer-sample fails for all PDF that I tried so far with the following error:
Caused by: net.sf.ghost4j.GhostscriptException: Cannot initialize Ghostscript interpreter. Error code is -20
at net.sf.ghost4j.Ghostscr开发者_如何学编程ipt.initialize(Ghostscript.java:318)
at net.sf.ghost4j.renderer.SimpleRenderer.run(SimpleRenderer.java:84)
... 3 more
Any advice?
I asked in a comment for Ghostscript and Ghost4J versions (the latter not so important, since I could still glean what happens from the latest tag 0.4.3).
I downloaded the Ghostscript code from here and saw from the error code headers file that -20
means that there was some sort of type error in the C code.
Here is the definition:
#define e_typecheck (-20)
Please try a different/later version of Ghostscript, or another variant, if possible. Alternatively, let me know what arguments you used to the example code, and host any example PDFs somewhere so we can try it out.
精彩评论