请教:PB9.0使datawindow生成pdf报表
这已经是一个老问题了,前面已经有好多人问过,但却没有明确的答复。
我已经抠了几天,利用saveas()生成html、xls文件都没有问题,但是到pdf就有问题了,不是生成不了文件就是生成的pdf文件用Adobe Reader 打不开。
帮助文档所说的需要GNU Ghostscript我也照着安装了,不过全是英文资料看的不是很透彻,还希望大虾指点:
To support saving as PDF using GNU Ghostscript, Ghostscript files are installed with PowerBuilder in Sybase\Shared\PowerBuilder\gs7.05. The default PostScript printer driver and related files are installed in Sybase\Shared\PowerBuilder\drivers.
When you deploy applications that use the ability to save as PDF using the distill method, you must deploy the gs7.05 and drivers directories in the same directory as the pbdwe90.dll runtime file. For example, if you deploy your application and pbdwe90.dll and the other PowerBuilder runtime files in a directory called MyApplication, the Ghostscript files must be deployed in MyApplication\gs7.05, and the default PostScript printer driver and related files must be deployed in MyApplication\drivers.
这是帮助文档里介绍的第一种方法,希望可以解决问题。
我使用的代码:
第一套:dw_1.SaveAs("D:\test2\aaa.pdf",pdf!,true)
第二套:
int li_ret
dw_1.Object.DataWindow.Export.PDF.Method = Distill!
dw_1.Object.DataWindow.Printer = "\\prntsrvr\pr-6"
dw_1.Object.DataWindow.Export.PDF.Distill.CustomPostScript="Yes"
li_ret = dw_1.SaveAs("D:\test2\aaa.pdf", pdf!, true)
第三套:
int li_ret
dw_1.Modify("Export.PDF.Method = XSLFOP! ")
dw_1.Modify("Export.PDF.xslfop.print='Yes'")
li_ret = dw_1.SaveAs("d:\test\PDFtemp2.pdf", PDF!, true)
安装GNU Ghostscript之前还可以生成pdf文件,就是打不开,安装GNU Ghostscript之后就生成不了了,只是自动打开一个tiff文件。
这个问题好像在csdn上已经存活好长时间了,好像有好多人都遇到此问题,问出来大多数虾们都说简单,却不说具体如何解决,如果是我们安装的问题,请指教!