I have an application built in 10.5 that was able to successfully create PDFs using SaveAs on Windows XP. When I moved to Windows 7 (32-bit), it failed by returning -1 and a zero length file.
I have tried everything I can figure out. I have tried numerous version of Ghostscript (8.54, 8.71, 9.01), deleted the driver and re-added it. I copied the ghostscript EXEs and DLLs into my application directory as well.
System variables include a GS_DLL=C:\Program Files\gs\gs9.01\bin\gsdll32.dll and a PATH that has C:\Program Files\gs\gs9.01\bin\; in it (tried it listed first and last in the path).
When I add the 'Sybase DataWindow PS' printer, I specify 'C:\Program Files\gs\gs9.01\lib\' as the folder. I have tried sharing and not sharing the printer.
I checked everything mentioned in Saving a datawindow as PDF in PB 10.5 and that still failed.
I'm at wits end... any other ideas?
--
-- More information added 2-MAR-2011
I should note this is PB10.5 -- not sure that matters. I also have my Windows security set up so that I get all the annoying user account control message boxes.
Here is how I added the printer - I believe it's all correct
Add A Printer
Use Existing Port, FILE: (Print to File)
For Driver
-- Have disk, selected "c:\Program Files\gs\gs9.01\lib\ghostpdf.inf"
-- (replace current driver)
Named it:
Sybase DataWindow PS (confirmed the spelling)
When I print a test page it creates a 177KB PDF file, but when I open it, I get an error: "Adobe Reader could not open 'test.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).
Same error when I try to print something from notepad to it.
When I print from the PB app using dw_1.saveAs( "c:\test\test.pdf", PDF! ) it returns a -1 and creates a 0 sized PDF.
I have applied the most recent Adobe update (seem to get those daily!).
I confirmed I have a registry key HKLM\SOFTWARE\GPL Ghostscript\9.01\ with values:
GS_DLL (REG_SZ) Set to C:\Program Files\gs\gs9.01\bin\gsdll32.dll
GS_LIB (REG_SZ) Set to C:\Program Files\gs\gs9.01\lib;C:\Program Files\gs\fonts
The DLL does exist in that directory and the two directories referred to by GS_LIB exist and have contents.
Thanks!
D
I feel your pain. I went thru this whole thing a year ago.
The way it works is that PowerBuilder sends its output to the printer driver. The printer driver outputs a postscript (.ps) file. Ghostscript takes this file and outputs a PDF file. If you're getting a 0 byte PDF, it may be that something is wrong with your Ghostscript setup.
Things to check:
- Is the printer set to print to a port called "FILE:"?
- Are there registry entries that point to Ghostscript? (This is how PB finds it.)
- Is the 'Sybase DataWindow PS' spelled exactly right?
- Is the 'Sybase DataWindow PS' using a driver for a PostScript printer?
The registry entries (I think) should be something like this:
HKLM\SOFTWARE\GPL Ghostscript\8.63
GS_DLL should point to gsdll32.dll (probably in your ghostscript bin folder)
GS_LIB is a list of paths (lib, font, resource)
When I saw your question, I realized the laptop I was currently using wasn't producing PDFs. Here's what I tried, flailing included:
- Logged out of my corporate account and into a machine admin account to be sure I had all the rights necessary
- Tried saving as PDF with a PB app (you'll never guess which one... well, OK, actually this one), which is supposed to create the appropriate printer driver, but didn't
- Read lots from the Application Techniques manual
- Downloaded and installed the Adobe Postscript printer drivers to make sure the correct DLLs were available
- Went back and renamed the Generic PS Printer driver to "Sybase DataWindow PS" (copied straight out of the Application Techniques manual), because I wasn't smart enough to name it right while the driver was being installed
- Tested again, with success
Had all that failed, I probably would have been down to using Process Monitor to try to figure out where the connections weren't being made. (PB uses printer driver to create a PostScript, .ps, file, which GhostScript processes.)
There's probably no way to tell if what I just experienced has any bearing on your situation, but maybe it will help. The Sybase newsgroups are full of people telling their stories to others that are having problems; this integration is probably the most problematic PB has.
Good luck,
Terry.
Response to 2-MAR-2011 Addendum
Yikes. OK, so I'm not entirely sure what ghostpdf.inf is supposed to do (my guess is that it wants to create a PDF directly), but it's not what's recommended. What you want is a printer driver that will produce a PostScript file, like "HP Color LaserJet PS" recommended in the manuals, pointed to File: port, and renamed to "Sybase DataWindow PS". Renaming the printer created by the installation of the Adobe printer driver would have sufficed as well.
My answer is maybe as simple as it can get.
I have been doing a lot of attempts to get this working with all of the recent versions of Ghostscript. The solution that finally got it working was just to use GhostScript 8.70, not any other version and to use the ghostpdf.inf file from this version. For one reason or another, I can't explain why, this seems to work...
We are using Powerbuilder 11.5 and ghostscript worked fine on Windows XP.
When we moved PB 11.5 to Windows 7 64 bit, tried everything and finally called Sybase Tech Support. This works, even from PowerScript. Note that PB 11.5 is not supported for Windows 7 but the tech was gracious. PB 12.5 is supported on Windows 7.
On Windows 7 64 bit there is an open CR, 710061, (bug report) that the 64 bit Ghostscript does not work with PB 12 or 12.5. This bug has been open since the end of May and has not yet been fixed in any version. As PB 11.5 is no longer under support, it would not be fixed in that version when this is addressed.
I just downloaded the latest version of Ghostscript, 9.06 64 bit and following the workaround below it is now working for me. I tested this with PB 12.5 but it should be the same for PB 11.5.
CR 710061 - SavesAs PDF does not work with ghostscript 9 on 64-bit Windows 7
PowerBuilder 12.1 and 12.5
Windows 7 64-bit
Windows 2008 64-bit
GhostScript 9.x 64-bit
When trying to save rows as PDF using ghostscript 9 failed on
64 bit Windows. There might be several issues including security issues.
With the 64-bit version of GhostScript the application is named gswin64c.exe
instead of gswin32c.exe. PowerBuilder looks for gswin32c.exe and not for gswin64c.exe
As work-around on 64-bit Windows 7 I was also able to get it to work
with the 64-bit version of the gs905 driver through:
- Install the "Sybase DataWindow PS" printer as follows:
Add a new printer as printing to file and use the "have disk" option;
then browse to the ghostscript \lib folder and select the file ghostpdf.inf.
The printer must be called "Sybase DataWindow PS".
- In the ghostscript \bin folder I made a copy of gswin64c.exe and name it gswin32c.exe.
For 32 bit operating systems, the ghostscript 32 bit versions should work as documented in the manuals. Link is below.
http://infocenter.sybase.com/help/topic/com.sybase.dc37774_1150/html/apptech/BABGDBHJ.htm