Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rawprint, comparing codes
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Rawprint, comparing codes
Miscellaneous
Thread ID:
01324353
Message ID:
01324353
Views:
76
Please compare both codes
Do you guys think is the any relevant differences between codes below



**************This is the code I am using********************

** Works fine, but some users complain it does not print****

Set Classlib To rawprint
vprdev=CreateObject("PrintDev")

If Empty(vprdev.cprintername)
vprdev.cprintername = GetPrinter()
Endif
vprdev.cfilename = 'myfile.txt'
If vprdev.oOpen()
if !vprdev.oPrintFile()
wait window 'Error'
endif
vprdev.oClose()
Endif
Release vprdev
Set Classlib to


**************This is the new code I found over the internet******************


*PrintRaw
LPARAMETER zcOutput

LOCAL lcPrinter
lcPrinter = UPPER(SET("PRINTER", 2))

LOCAL lcSavePrinter
lcSavePrinter = SET("PRINTER", 3)
SET PRINTER TO NAME (lcPrinter)

LOCAL oPrnDev
SET CLASSLIB TO RawPrint ADDITIVE
oPrnDev = CREATEOBJECT("PrintDev")
oPrnDev.cPrinterName = lcPrinter
oPrnDev.cDocName = "Receipt"
IF oPrnDev.oOPen()
** Send the data and codes and reset the line spacing to 1/6th inch...
oPrnDev.oPrintMem(zcOutput + CHR(27) + "2")
oPrnDev.oClose()
ELSE
* Error opening device; fall thru for now
ENDIF
RELEASE oPrnDev
RELEASE CLASSLIB RawPrint

SET PRINTER TO NAME (lcSavePrinter)
RETURN
Next
Reply
Map
View

Click here to load this message in the networking platform