How do I get a DataWindow to save correctly to PDF?

user1519082 picture user1519082 · Jul 11, 2012 · Viewed 11.7k times · Source

Here's my problem. I currently am trying to print a DataWindow to a PDF file in PowerBuilder 12.5. I got some code, and it currently looks like this.

//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)

I installed GhostScript on the machines, but I read at some places that I would need to create a new printer and set some drivers in the PB driver directory. Could anybody enlighten me?

Answer

Carl Wyles picture Carl Wyles · Jul 11, 2012

I just did this myself.

you want to install ghostscript http://www.ghostscript.com/download/gsdnld.html and have the right one for your OS (32bit vs 64bit) I used the 9.02 version myself

You install it as an administrator for the machine, and the installer program should auto generate the "Sybase Datawindow PS" Printer device for you.

Once that is done you don't have to set any thing in the datawindow for for it to work, the defaults are ok

Just do: dw_1.saveas( "c:\somefilename.pdf", PDF!, false ) and viola! a pdf