Powerbuilder 9-如何使用adobe writer代替SaveAs()的Ghostscript

Powerbuilder 9-如何使用adobe writer代替SaveAs()的Ghostscript,adobe,ghostscript,powerbuilder,Adobe,Ghostscript,Powerbuilder,我们有Adobe PDF writer,希望能够使用它而不是ghostscript。SaveAs()函数是否锁定在ghostscript中?如果是,我如何使用adobe pdf writer来解决此问题?我认为这可能是解决方案: 关键的变化是,您需要创建自己的打印机,而不是使用Adobe附带的GhostScript文件 我认为您应该以以下方式创建Adobe PDF打印机: 因此,您应该使用以下文件添加本地打印机: C:\Program Files\Adobe\Acrobat 9.0\Acro

我们有Adobe PDF writer,希望能够使用它而不是ghostscript。SaveAs()函数是否锁定在ghostscript中?如果是,我如何使用adobe pdf writer来解决此问题?

我认为这可能是解决方案:

关键的变化是,您需要创建自己的打印机,而不是使用Adobe附带的GhostScript文件

我认为您应该以以下方式创建Adobe PDF打印机:

因此,您应该使用以下文件添加本地打印机:

C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Xtras\AdobePDF”。单击 “AdobePDF.inf”

在此之后,代码应类似于以下内容:

int li_ret

dw_1.Object.DataWindow.Export.PDF.Method = Distill!
dw_1.Object.DataWindow.Printer = "YourAdobePDFPrinterName"
dw_1.Object.DataWindow.Export.PDF.Distill.CustomPostScript="Yes"

li_ret = dw_1.SaveAs("custom.PDF", PDF!, true)
当然,打印可能会有许多其他问题。请随意提问

Br.:Gábor

SaveAs()函数与使用Ghostscript相关联,要使用Adobe Acrobat打印,您可以将其视为常规打印机。希望PB 9具有这些函数,因为这是从PB 11.5获得的

RegistrySet("HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\9.0\AdobePDFOutputFolder", "", ReguLong!, 2)
RegistrySet("HKEY_CURRENT_USER\Software\Adobe\Acrobat Distiller\9.0\AdobePDFOutputFolder", "2", RegString!, "C:\_APPS")

//Gets the default printer
ls_default = PrintGetPrinter()

//Parses string
ll_pos = Pos(ls_default, "~t")
is_default_printer = Left(ls_default, ll_pos - 1)

//Gets the Printers on the computer
ls_printers = PrintGetPrinters( )

//Finds the Distiller printer
ll_pos = PosA(ls_printers, "Acrobat Distiller") 

//Checks for newer version of Distiller
if (ll_pos = 0) then
    ll_pos = PosA(ls_printers, "Adobe PDF") 
end if

//Gets the location of the Distiller printer
ls_printer = MidA(ls_printers, ll_pos, PosA(ls_printers, ":", ll_pos) - ll_pos + 1)

//Sets our next print ll_job to print to Distiller
PrintSetPrinter(ls_printer)

//Allocates memory for our DS
DS = create DataStore

//Opens Print Job
ll_job = PrintOpen("MyPDF", false)

//Checks for error
if (ll_job > 0) then

//First Datastore to add to the PDF
DS.DataObject = "d_wlcp_view"
DS.SetTransObject(SQLCA)
DS.Retrieve(idt_review_date, ii_site_id)
PrintDataWindow(ll_job, DS)

//You can add more pages to the PDF by printing more DW's or DS's
DS.DataObject = "d_training_view"
DS.SetTransObject(SQLCA)
DS.Retrieve(idt_review_date, ii_site_id)
PrintDataWindow(ll_job, DS)

//Closes the print job
PrintClose(ll_job)

//Sets the default printer back
PrintSetPrinter(ls_default)

//Sometimes the PB function doesn't set the printer back, so you can use
//this VB script to make sure it is set back to the default
//Run('cscript C:\_APPS\HWLCPRR\prnmngr.vbs -t -p "' + is_default_printer + '"')

//Deallocates memory for DS
if (isValid(DS)) then destroy DS

.

我执行了上述所有步骤,并通过重命名可执行文件和DLL在我的开发计算机上禁用了ghostscript。saveas()返回值为-1。有一次,我将ghostscript文件重命名为其原始名称,并执行了saveas()操作它工作了,但没有使用adobe writer,而是使用ghostscript蒸馏器。这就好像Powerbuilder正在明确地寻找ghostscript,即使我将代码更改为上面的列表。在尝试此操作之前,我正在尝试将数据窗口保存为pdf文档,以便我可以通过电子邮件发送它。这可以做到吗?我尝试了,它确实创建了pdf文件。我希望该文件自动转到我在代码中提供的文件夹。是否有任何方法可以动态设置adobe pdf打印机的默认文件夹?用户可以从弹出的对话框中执行此操作,但用户无法知道该文档应放在何处。请参阅t处的两行新代码中我修改的脚本当然,注册表项会根据您拥有的Acrobat版本而有所不同,因此您可以检查注册表中的正确文件夹。此外,如果您的用户使用Acrobat作为打印机之一来创建自己的PDF,则您可能需要添加其他代码来保存默认值,然后将其设置回该文件夹。非常感谢太多了!剧本看起来写得很好。