0

I have a project in which I need to convert PDF file into png using ghost4j. The issue I am facing is that when I run my java code the console throws me this error:

Unable to load library 'gs': dlopen(libgs.dylib, 9): image not found

I googled this error and found that I also need to install ghost script and make some changes in the file libgs.dylib. I have installed ghost script using Mac Port but I am not able to find where this file libgs.dylib is located on my file system. I am clueless what to do next. Need Help.

-PS I am using Mac OS X 10.9.2 as my development environment.

Jason C
  • 38,729
  • 14
  • 126
  • 182
Corporal
  • 157
  • 3
  • 14
  • Your question does not appear to be related to converting PDFs to PNGs. – Jason C Apr 22 '14 at 05:26
  • possible duplicate of [How can i use ghost4j on OS X 10.9](http://stackoverflow.com/questions/20823756/how-can-i-use-ghost4j-on-os-x-10-9?rq=1) – Jason C Apr 22 '14 at 05:28

1 Answers1

0

From https://github.com/zippy1978/ghost4j/issues/29:

Setting LD_LIBRARY_PATH helped:

$ port install ghostscript
$ port contents ghostscript | grep libgs
  /opt/local/lib/libgs.9.10.dylib
  /opt/local/lib/libgs.9.dylib
  /opt/local/lib/libgs.dylib
$ export LD_LIBRARY_PATH=/opt/local/lib

Use whatever path the port contents command reveals.

To make the changes permanent, you'll have to add it to LD_LIBRARY_PATH permanently. I don't know how to do that on OSX, as I am not a Mac user, but it is an easy thing to find out on the internet.

See also search results for "osx install libgs.dylib".

Community
  • 1
  • 1
Jason C
  • 38,729
  • 14
  • 126
  • 182
  • I have done the steps you mentioned, but still when I run the java code I get the same error i.e "Unable to load library 'gs': dlopen(libgs.dylib, 9): image not found". Now when I search the /opt/local/lib directory I can see the libgs.dylib file there. – Corporal Apr 22 '14 at 06:29