Trick Windows into using a newer version of Ghostscript



Background

For an unattended installation of a well known ticketing application, I ran into a application requirement of Ghostscript 7.05 for certain report functionality to work properly.

Unfortunately, GS 7.05 cannot be installed silently due a bug in the installer.

To work-around this, I installed Ghostscript 9.02 using the silent installer switch, but the ticketing software would not generate PDF reports as it was unaware of the new GS version with error "GhostScript version 7.05 is required..."

Steps

To remedy this, we added the registry keys for 7.05, but pointed them to the 9.02 installation directory.  This is how we did it (using a batch file):

REM Silent install of Ghostscript 9.02 
C:\gs902w32.exe /S
REM Import Ghostscript 7.05 registry hack
regedit.exe /s "C:\gs.reg"

Here are the contents of "gs.reg":
Windows Registry Editor Version 5.00 
[HKEY_LOCAL_MACHINE\SOFTWARE\GNU Ghostscript]
[HKEY_LOCAL_MACHINE\SOFTWARE\GNU Ghostscript\7.05]
"GS_DLL"="C:\\Program Files\\gs\\gs9.02\\bin\\gsdll32.dll"
"GS_LIB"="C:\\Program Files\\gs\\gs9.02\\bin;C:\\Program Files\\gs\\gs9.02\\lib;C:\\Program Files\\gs\\gs9.02\\fonts"

To perform this same trick with other Ghostscript versions, export the registry key HKEY_LOCAL_MACHINE\SOFTWARE\GPL Ghostscript\, and edit the registry key to reflect your needed version (don't touch GS_DLL or GS_LIB values).

If you need to do this on a 64-bit OS, consider the following:

 
Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GNU Ghostscript]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\GNU Ghostscript\7.05]
"GS_DLL"="C:\\Program Files\\gs\\gs9.02\\bin\\gsdll64.dll"
"GS_LIB"="C:\\Program Files (x86)\\gs\\gs9.02\\bin;C:\\Program Files (x86)\\gs\\gs9.02\\lib;C:\\Program Files (x86)\\gs\\gs9.02\\fonts"

On 64-bit platforms, you may need to install both versions.  The 64-bit version installs the correct INF file for the Distiller driver, however, the 32-bit version's EXE is what is usually needed for backwards compatibility with older versions of Ghostscript.

Note that GS 7.05 installed to C:\gs, where GS 9.02 installed to C:\Program Files\GS.  This shouldn't affect compatibility.  If the application you are using is hard-coded to look in C:\GS, consider this work-around:

Warning, read note above before running this command!!!
mklink /d c:\gs "c:\program files\gs"

-Tres

Comments

Popular posts from this blog

iPod Touch iPhone 3G Ubuntu 9.10 in 5 minutes

Pidgin - Microsoft Office Communicator

Netflix + Ubuntu