Saving a datawindow as PDF in PB 10.5

George Dontas picture George Dontas · Mar 17, 2010 · Viewed 21.5k times · Source

I have a grid datawindow with a picture in it's background (with dimensions of an A4 page) and I would like to export both data and the picture as a (single page) PDF file. I used several combinations of the following commands but at most I got a 0-sized pdf.

//dw_1.Modify("Datawindow.Export.PDF.Method = Distill! ")
//dw_1.Modify("DataWindow.Export.PDF.Method = XSLFOP! ")

dw_1.Object.DataWindow.Export.PDF.Method = Distill!
//dw_1.Object.DataWindow.Printer = "\\prntsrvr\pr-6"
dw_1.Object.DataWindow.Export.PDF.Distill.CustomPostScript="No"
dw_1.SaveAs("c:\dw_one.pdf", PDF!, false)

User’s guide (on page 533) says:

… the data is printed to a PostScript file and automatically distilled to PDF using GNU Ghostscript…

Installing Ghostscript

For licensing reasons, Ghostscript is not installed with PowerBuilder. You (and your users) must download and install it before you can use this technique…

Does anyone have any idea what is the procedure?

EDIT THANK YOU ALL. Installing ghostscript proved to be enough. I only cannot understand why the procedure is successful on some fellows PCs (using Method = XSLFOP!) without using ghostscript :-/

Answer

Hugh Brackett picture Hugh Brackett · Mar 17, 2010

Ghostscript and Printer setup for PowerBuilder

Administrative privileges are required to install the printer. We are using this setup on XP.

These instructions use an HP printer driver instead of the one supplied by Sybase. If for some reason you don't have this driver, you can download it from HP. The HP driver has the following advantages:

  • Generated PDFs can be read by a Screen Reader (YMMV, but the Sybase driver output isn't readable at all.)
  • Driver is digitally signed for installation on systems that require signed drivers

Needed files

  • gs860w32.exe from http://pages.cs.wisc.edu/~ghost/ (you can try a later version if you like. 8.60 is working fine for us.)
  • Driver files in C:\Program Files\Sybase\Shared\PowerBuilder\drivers (path may vary depending on installation)

Ghostscript

Install gs860w32.exe

  • Install to C:\Program Files\gs
  • Check All Users
  • Check Install Ghostscript Fonts

Sybase DataWindow PS Printer

The printer name is case-sensitive and has to be exactly what is inside the quotes. There is no space in “DataWindow”. The easiest way to get it right is to copy from this document and paste it in.

  • Open Control Panel, Printers and Faxes
  • Choose Add printer (next)
  • Choose Local printer, uncheck Automatically detect and install my Plug and Play printer (next)
  • Choose Use the following port, select FILE: (next)
  • In the left-hand list, select 'HP' for the manufacturer
  • In the right-hand list, scroll down and select 'HP 8150 Series PS' (next)
  • Printer name "Sybase DataWindow PS"
  • Use as default printer select No (next)
  • Leave Do not share selected (next)
  • Print test page, select No (next)
  • (finish)