一、有时客户会要求把相关报表转换为PDF的情况,目前已经解决。分为pb9(win7 32)和pb12.5(win7 64)两种版本讨论,现在整理解决要点如下:
1.pb9(win7 32)环境下,需要安装Ghostscript(gs705w32版本),然后再安装虚拟打印机。安装虚拟打印机步骤:点击添加打印机,选择从磁盘安装,选择PB的安装目录下的Shared\PowerBuilder\drivers下的ADIST5,然后选择Acrobat Distiller或者其它四个即可。如果此驱动安装失败,无法显示虚拟打印机,则可以安装AcrobatDistiller5.0。打印机名称为Acrobat Distiller。安装完成后,采用以下方法即可打印:
int li_ret
dw_1.Object.DataWindow.Export.PDF.Method = Distill!
dw_1.Object.DataWindow.Printer = "Acrobat Distiller"
dw_1.Object.DataWindow.Export.PDF. &
Distill.CustomPostScript="Yes"
li_ret = dw_1.SaveAs("custom.PDF", PDF!, true)
2.pb12.5(win7 64)环境下,需要安装Ghostscript(gs705w32版本,安装到PBVM125.DLL同级目录下,如此dll在C:\a下,则此程序的目录为c:\a\gs),然后再安装虚拟打印机。安装虚拟打印机时以上打印机无法安装,需要安装Adobe Acrobat 9 Pro,此版本安装时会安装虚拟打印机驱动(有高手可以单独把此驱动抽出来)。安装完成后再添加一个名为Sybase DataWindow PS的新打印机。打印调用方法如下:
int li_ret
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"
li_ret = dw_1.SaveAs("custom.PDF", PDF!, true)
二、PB9采用ole db方式连接 asa 数据库。
分为连接 asa8和asa11两种情况:
1. 需要pb9动态库和asa8动态库。
pb9动态库:pbvm90.dll,libjcc.dll, pbdwe90.dll, pbdwr90.dll, pbdwr90.pbd, pbjag90.dll, pbjvm90.dll, pbole90.dll, pbrtc90.dll, pbtra90.dll
asa8动态库:dblgen8.dll,dbodbc8.dll,dboledb8.dll,dboledba8.dll,dbserv8.dll,dbcon8.dll,dbctrs8.dll,dbeng8.exe
连接 asa8 代码如下:
String ls_dbparm
String ls_command
gs_appDirectory = GetCurrentDirectory ( )
ls_dbparm = "PROVIDER='ASAProv.80',"
ls_dbparm += "PROVIDERSTRING='database="+gs_appDirectory+"\test\billdb.db',DATASOURCE='(local)'"
SQLCA.DBMS = "OLE DB"
SQLCA.LogPass = "sql"
SQLCA.LogID = "dba"
SQLCA.AutoCommit = False
SQLCA.DBParm = ls_dbparm
ls_command = "Regsvr32 /s " + "~"" + gs_appDirectory + "\dboledb8.dll" + "~""
If Run(ls_command) <> 1 Then
MessageBox("提示","注册dboledb8.dll文件失败,请手动注册")
End If
ls_command = "Regsvr32 /s " + "~"" + gs_appDirectory + "\dboledba8.dll" + "~""
If Run(ls_command) <> 1 Then
MessageBox("提示","注册dboledb8.dll文件失败,请手动注册")
End If
Connect ;
2. 需要pb9动态库和asa11运行动态库。
pb9动态库:pbvm90.dll,libjcc.dll, pbdwe90.dll, pbdwr90.dll, pbdwr90.pbd, pbjag90.dll, pbjvm90.dll, pbole90.dll, pbrtc90.dll, pbtra90.dll
asa11运行动态库:mlsrv11.lic, rteng11.lic, dbcon11.dll, dbctrs11.dll, dbeng11.exe, dbeng11.lic, dbicu11.dll, dbicudt11.dll, dblgde11.dll, dblgen11.dll, dblgzh11.dll, dbodbc11.dll, dboledb11.dll, dboledba11.dll, dboraodbc11.dll, dbserv11.dll, dbsrv11.lic
连接 asa11代码:
String ls_dbparm
String ls_command
gs_appDirectory = GetCurrentDirectory ( )
ls_dbparm = "PROVIDER='SAOLEDB.11',"
ls_dbparm += "PROVIDERSTRING='DBF="+gs_appDirectory+"\tianjinbilldb.db'"
SQLCA.DBMS = "OLE DB"
SQLCA.LogPass = "sql"
SQLCA.LogID = "dba"
SQLCA.AutoCommit = False
SQLCA.DBParm = ls_dbparm
ls_command = "Regsvr32 /s " + "~"" + gs_appDirectory + "\dboledb11.dll" + "~""
If Run(ls_command) <> 1 Then
MessageBox("提示","注册dboledb11.dll文件失败,请手动注册")
End If
ls_command = "Regsvr32 /s " + "~"" + gs_appDirectory + "\dboledba11.dll" + "~""
If Run(ls_command) <> 1 Then
MessageBox("提示","注册dboledba11.dll文件失败,请手动注册")
End If
Connect ;