Windows 7 x64
PB 12.5 Classic
Ghostscript 9.07 (both x32 and x64 are installed)
HP Laserjet PS printer installed as
Its about 18 Months ago that we had this problem. IIRC the basic problem is that the driver for the printer must be 64-Bit and you must then use the appropriate 64-Bit Ghostcript exe gswin64c.exe. As far as I see it, Powerbuilder being a 32-Bit application is hard wired to gswin32c.exe.
I ended up having to practically manually do what Powerbuilder does. First I had to find the path of gswin32c.exe or gswin64c.exe by searching the relevant parts of the Registry. This means searching both the 64-Bit part and the 32 Bit-part, since our application does not just run on 64-Bit machines. I think I ended up using ProcessMonitor and ProcessExplorer to watch Powerbuilder in action and mimic what it was doing.
Once you have determined the path of the Ghostscript-EXE you can manually set the Printer to "Sybase DataWindow PS" and do pDw.Object.DataWindow.Print.FileName = sz_pathps where sz_pathps is a path to a temporary file where your PostScript file will be produced via the distiller. You then do pDw.print(false,false) and you have a PostScript file.
Then you can manually call GhostScript using the path to the exe that you found in the registry. The command line parameters I use are
-q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=xxxxx.pdf -c .setpdfwrite -f yyyyy.ps
xxxxx.pdf is the path of the PDF-File you wish to produce and yyyyy.ps is the path of the PS-File that you produced using the distiller.
Manually calling the GhostScript-Exe means calling CreateProcess and then subsequently WaitForSingleObject.
This of course means you are not able to use dw.saveas any more and will have to offer some that of Menu or Icon that does the job.
This is indeed truly messy but I had no alternative. It was "must have" functionality, so I had to do it.
There you are, this is my first contribution to stackoverflow and I hope it helps.
Greetings,
Richard Sharp
I think I had the same problem. The problem is in the version of the Ghostscript software:
http://ghostscript.com/pipermail/gs-bugs/2012-July/026615.html
You should uninstall the Ghostscript and reinstall this version: Ghostscript 8.71. You can download it from here:
http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/8.71/ http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/8.71/gs871w64.exe/download
After this it should work :)
Good luck!
Br. Gábor