devSendData to set Paper Type

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

devSendData to set Paper Type

Postby andreas » Wed Apr 22, 2009 12:27 pm

Hi,
I'm trying to set the Paper Type (Media Type) whit the devSendData command. Here you find the VFP code I'm using for my tests.

cPT_col = "WdColoredPaper"

doprint(of.vpe, 4, cPT_col)

Function doPrint(vpe, nTray, cPaperType)
cPT = chr(27) + "&n"+alltrim(str(len(cPaperType)-1))+cPaperType
vpe.openDoc()
vpe.printoptions=16
vpe.device = "\\printserver\printer"

vpe.print(100,300,"Test Text Tray "+alltrim(str(nTray))+": "+ substr(cPT,1))
vpe.printDoc(.f.)
vpe.closeDoc()

endfunc


DEFINE CLASS PrintEngine AS ASE_VPE
FUNCTION DoPrintDevData(page, nResAct)
? "DoPrintDevData:" + " Page:"+ alltrim(str(page)) + " Action:"+ alltrim(str(nResAct))
? cPT
this.devSendData(cPT)
return (ASE_VPE::DoPrintDevData(page, nResAct))
ENDFUNC

FUNCTION PrintDoc(lWithSetup)
return (ASE_VPE::PrintDoc(lWithSetup))
ENDFUNC

FUNCTION RequestPrint(nAct,nResAct)
? "RequestPrint:" + " Act:"+ alltrim(str(nAct)) + " Action:"+ alltrim(str(nResAct))
ENDFUNC

ENDDEFINE


The Printer is setup to have the color paper in tray 4, but it takes the paper from tray 5.

Selecting the trays directly is no option. Setting the Paper Type in the Setup works, but I need to control it from the code.

Setting up several PRS files is also no option as the configuration changes often.

Any idea how the might work?

Thanks
Andreas



Thanks it is working now! :)
Last edited by andreas on Wed Apr 22, 2009 2:13 pm, edited 1 time in total.
andreas
 
Posts: 2
Joined: Fri Jan 30, 2009 4:33 pm

Postby IDEAL Software Support » Wed Apr 22, 2009 2:09 pm

The DevSendData() method may only be called when processing the DoPrintDevData event. If you call DevSendData() while not processing the event, the method does nothing.

Please see the manuals for details.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 4 guests