开发者

Creating PDF file in PowerBuilder

I am new to PowerBuilder. I got an assignment to create a PDF file using PowerBuilder. How can I do 开发者_StackOverflowthat?


Our organization used to use Ghostscript, but has instead moved to Amyuni.


as suggested by Alberto Megia, download PDF creator, but dont use SAVE AS. After you install pdf creator it will install a printer, use that printer to save the datawindow with the print function.

after call print function, you will see a "Save as" dialog.

If you use "saveas" function, the pdf will not have the format that the datawindow shows.


What version of PowerBuilder are you using? The most recent versions have PDF capability built in (using Ghostscript).


Install Ghostscript. Get PDFCreator for free there and install it. Then you can save as PDF any datawindow or datastore with the statement:

dw_1.saveAs(path_where_to_save_with_name_of_file.pdf, PDF!, true)

Third parameter is for override if the file exists with that name. I hope it works for you. Regards, Alberto


We just use Ghostscript. I wrote Ghostscript setup instructions earlier. We also print Word documents we've filled in to PDF from our app by printing them to 'Sybase DataWindow PS' printer then running Ghostscript to make the PDF.


Good Question - There really isn't an easy way other than finding a third party tool. I've tried the prior method mentioned and it does work but not without headaches and you are left with deployment headaches, deploying ghost script and having to make sure Post Script drivers are on the client.

I ended up trying many PDF converters, both free and paid, the one that worked most seamlessly was one that installed as a "printer" such as if you have Adobe installed on the PC, but you need to dynamically verify existence of the printer via RegistryGet and if it doesn't exist ask user to install or install it dynamically via code, and registry entries (not fun).

After several headaches mostly related to deployment issues I ended up going with a server solution, but it requires having a server that you can have a process (distiller) running that grabs post script files and distills them to PDF. I used a response window with progress bar, the PB app printed post script file to server location upon which the distiller grabs and converts. My PB app polls the server until it finds the PDF, or the user cancels whichever comes first. With a good distiller the process is fast (< 5 seconds) which was acceptable to our users.

Upon existence of the PDF, we'd attach it to an email and send via Oracle (mapi). This solution limits the requirements on client to post script driver which in most corporate environments is there, but you need to check it via Registry. Maybe there is a better solution out there since I did this last, around 2008.

fyi- I usually don't make vendor recommendations but will in this case because there was one that stood out in ease of use and quality, it was called PDFCreator which installs as a windows printer. It looks to be open-source right now but I recall that we would have had to pay to use it in corporate environment.

Good Luck.


Use the tutorial How to use PowerBuilder to create PDF file?.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜