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

时间:2013-03-11 17:47:56

标签: adobe ghostscript powerbuilder

我们有Adobe PDF编写器,并希望能够使用它而不是ghostscript。 SaveAs()函数是否锁定为ghostscript,如果是这样,我如何使用adobe pdf writer来解决这个问题?

2 个答案:

答案 0 :(得分:2)

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

http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00844_1150/html/pbug/pbug526.htm

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

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

http://www.ehow.com/how_5782035_add-adobe-pdf-printer.html

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

  

C:\ Program Files \ Adob​​e \ Acrobat 9.0 \ Acrobat \ Xtras \ Adob​​ePDF“。点击   “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

答案 1 :(得分:1)

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

Here is the VB Script