问题
Platform:
Windows 7 x64
PB 12.5 Classic
Ghostscript 9.07 (both x32 and x64 are installed)
HP Laserjet PS printer installed as "Sybase DataWindow PS"
Datawindow's Data Export tab has Format to configure: PDF
and Method: Distill
. Both the checkboxes "Distill custom postscript" and "Print using XSLFOP" are unchecked.
I click File | Run/Preview
and File | Save Rows As
and select PDF
as save as type and enter a pdf file name and click on Save. It says in a message box that Save Rows As failed
. I find the file has been created on disk but with size 0 bytes.
I have noticed that the manual states this can happen if Ghostscript is not installed. However, I have installed first x64 and then also x32 versions of Ghostscript. I installed x64 cause somewhere in the PB manual it mentioned that I need to install Ghostscript for the platform of the OS and since I am on x64 Win7 I installed x64 Ghostscript. However, it is not working on both.
What could be wrong? Anyone any ideas? I have searched the net and stackoverflow for solutions and everyone seems to be pointing to x32 platform (it seemed to me) as also on XP. My XP installation earlier was working fine. I am now on Win7 x64 and need this to work on it.
TIA
回答1:
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
回答2:
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
来源:https://stackoverflow.com/questions/15853014/powerbuilder-12-5-classic-pdf-saveas-creating-files-of-0-size-on-win7-x64