method pushButton(var eventInfo Event)
var
piCurrent,
piAcrobat printerInfo
rpt Report
rpi ReportPrintInfo
astrPrinters Array[] String
strPrintInfo String
siCounter SmallInt
endVar
const
DEVICE = "Acrobat PDFWriter"
endConst
; save current config
printerGetInfo( piCurrent ) ; save current info
; locate the target printer
enumPrinters( astrPrinters )
for siCounter from 1 to astrPrinters.size()
strPrintInfo = astrPrinters[ siCounter ]
if strPrintInfo.search( DEVICE ) = 1 then
quitloop
else
strPrintInfo = "" ; clear for error condition
endIf
endFor
if strPrintInfo = "" then ; error
msgStop( "Can't Print Report", "Reason: " +
DEVICE + " doesn't appear to be installed." )
else
; run the report.
printerSetCurrent( strPrintInfo )
; print the report w/o the Print dialog. (Yes, just two lines.)
rpi.name = ":work:customer"
rpt.print( rpi )
; restore current config
printerSetCurrent( piCurrent.DeviceName + "," +
piCurrent.DriverName + "," +
piCurrent.PortName )
endIf
endMethod