Running ghostcript from a non-standard install location

Dec 31, 2013 at 1:25 AM
I've placed a copy of the ghostscript 9.05 install under the Public user. Unfortunately when I try to read a PDF it fails unless I setup the registry with the values below.

Export from Regedit:
[HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript]

[HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript\9.05]
"GS_DLL"="C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\bin\\gsdll64.dll"
"GS_LIB"="C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\bin;C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\lib;C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\fonts"
The bizarre part is if I set the same environment variables it doesn't seem to matter. Only the registry settings work. I'd like to be able to run my app without having admin rights to set the registry.
Coordinator
Dec 31, 2013 at 5:02 AM
Edited Dec 31, 2013 at 5:02 AM
You can also use HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. At this moment there is no other way to accomplish this. I will have to make some changes to ImageMagick to allow that. Adding an environment variable called MAGICK_GHOSTSCRIPT_PATH to accomplish this sounds like a good idea.
Dec 31, 2013 at 5:02 PM
Edited Dec 31, 2013 at 5:07 PM
Thanks for the info about HKEY_CURRENT_USER. That fixes the administrative requirements, unfortunately it doesn't seem to work.

When I placed GS_DLL and GS_LIB in the same relative location in HKCU as HKLM I still get the "Magick: Postscript delegate failed" message.
Coordinator
Dec 31, 2013 at 6:43 PM
Have you tried to enable logging in MagickNET and set Debug to true in your MagickImage to receive more information?
Dec 31, 2013 at 8:51 PM
I'm not sure how to enable logging in Magick.NET or how to set Debug to true in MagickImage. Can you point me to some documentation?

Just for additional clarity:

I am able to run without any problems when the GS_DLL and GS_LIB options are placed in HKLM and when I remove them from the HKLM and put them here:
[HKEY_CURRENT_USER\SOFTWARE\GPL Ghostscript]

[HKEY_CURRENT_USER\SOFTWARE\GPL Ghostscript\9.05]
"GS_DLL"="C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\bin\\gsdll64.dll"
"GS_LIB"="C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\bin;C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\lib;C:\\Users\\Public\\configs\\apps\\DRWOverlay\\gs\\gs9.05\\fonts"
Then it fails and behaves the same whether I have them in HKEY_CURRENT_USER or not.
Coordinator
Jan 1, 2014 at 5:25 PM
Edited Jan 1, 2014 at 9:44 PM
This is a bug in ImageMagick and I will have to fix this for you. It only works if it can also the find the 'HKLM' version.

You can enable logging like this:
MagickNET.SetLogEvents(LogEvents.All); // LogEvents.All will show you the most information.
MagickImage image = LoadImage();
image.Debug = true;
PerformActions(image);
The output will be written to the console and the debug window of visual studio. I am working on adding a Log event to the MagickNET class. I will add a page about this to the documentation when that is finished.
Coordinator
Jan 3, 2014 at 7:46 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.