When work on a project several years ago, I was asked to create PDF files using PowerBuilder and the process would be triggered by a web service written in C#.
The first issue I ran into was how to communicate between PowerBuilder and .NET web services. I wrote about this in detail in another blog , so I am not going to repeat it here.
Since PowerBuilder doesn’t have intellisense, it is hard to write code with a lot of business entities. So I put all the business logic on the .NET side. PowerBuilder was only used to take the data passed in, build the datawindow and save the datawindow to PDF file.
Here are the steps for saving a datawindow into PDF file:
- Install GhostScript. I have GhostScript 7.06 installed. You can download this from the Internet for free.
- Create a new folder under GhostScript directory c:\gs\PdfPrinterSetupFiles and copy the following files to this location. I don’t remember where I downloaded those files, but you should be able to find them on the Internet.
ADIST5.INF
ADIST5.PPD
ADIST5CS.PPD
ADIST5CT.PPD
ADIST5J.PPD
ADIST5K.PPD
PSCRIPT.DLL
PSCRIPT.DRV
PSCRIPT.HLP
PSCRPTUI.DLL
- Setup a “Sybase DataWindow PS” printer on your machine.
a) Open “Add Printer”
b)Hit Next in that dialog.
c) Select "Local Printer" and hit Next.
d)For "Use the following port", select "File:" and hit Next.
e)Hit "Have Disk"
f) Browse to the directory we created above (in item 6) and select the ADIST5.INF file, then hit Open.
g)Hit OK to close the Install from Disk dialog.
h) Select "Acrobat Distiller" and hit Next.
i) It may prompt you to keep existing driver, your choice, hit Next.
j) For Printer Name, enter "Sybase DataWindow PS". Or you can enter something else, and then add that printer name to the DataWindow print specs. Hit Next.
k) On printer sharing, hit Next.
l) Decide whether or not you want a test page, and then hit Next.
m) Hit Finish.
- Create a datawindow in the PowerBuilder application. Set the properties of the datawindow to the following
dw_1.Object.DataWindow.Export.PDF.Method = Distill!
dw_1.Object.DataWindow.Printer = "Sybase DataWindow PS"
dw_1.Object.DataWindow.Export.PDF.Distill.CustomPostScript="Yes"
- The rest was easy. Just call SaveAs function and you are done.
dw_1.SaveAs(filename, PDF!, FALSE)
Some days ago I worked with my book in pdf format.And today I opened it again and it was empty.I was frightened,but I was lucky and a good man advised me-pdf fix,exactlier it was my friend.Program solved my problems in 30 seconds and for free.I knew how tool can recover text, graphics, hyperlinks and object forms used in the document.
ReplyDeleteCan convert this PDF file to a TIFF image?
ReplyDelete