ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Print functions
  • WLanguage code without using iEscape
  • Sending data with iEscape
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
iEscape (Function)
In french: iEscape
Sends an ESCAPE command or a data command to a printer.
Caution: the Escape commands are specific to the hardware used.
The Escape commands are not interpreted by the driver but they are directly sent to the printer. Therefore, an Escape command may produce a totally different result from one printer to another.
The print preview must not be used in order for the Escape commands to be taken into account.
Example
sEscapeSequence is ANSI string
i is int
 
iConfigure("Epson LQ-2170 ESC/P 2")
iDestination(iPrinter, "Roll labels back")
 
// 3 times 6 request for 7/216th of an inch
// to go back 3 labels
// (for the printer used)
FOR i = 1 TO 6*3
sEscapeSequence += ESC + "j7"
END
 
// Send the Escape commands all at once
iEscape(sEscapeSequence)
 
// You can add other print commands and calls to iEscape here...
...
 
// End of print
iEndPrinting()
Syntax
iEscape(<Command to send>)
<Command to send>: ANSI character string
Escape sequence to send to the printer. These commands are specific to each printer.
The entire Escape command must be specified, including the Esc character if necessary.
See the printer documentation to get the list of its Escape commands.
Remarks

WLanguage code without using iEscape

For comparison, the WLanguage code used to send Escape codes to a printer by directly writing to the port is as follows:
sPort is string = "LPT1"
// Open the port
nNumFile is int = fOpen(sPort, foWrite)
IF nFileNum = -1 THEN
Error("Failure while opening " + sPort, ErrorInfo())
RESULT False
END
// 3 times 6 requests for 7/216th of an inch
// (for the printer used)
FOR i = 1 TO 6*3
 fWrite(nNumFile, ESC + "j7")
END
// Close the port
fClose(nFileNum)

Sending data with iEscape

iPrint is used to send data to the printer driver.
iEscape is used to send data to the printer directly.
If an ESCAPE command is sent to the printer with iEscape to specify a font size for example, this font size will be ignored if data is sent thereafter by iPrint (which sends data to the driver).
For example, printing on a ticket printer without using the printer driver will be done without calling iPrint:
INITPRNT is ANSI string = Charact(27) + "@"
CPI10 is ANSI string = Charact(27) + "[4w"
CPI15 is ANSI string = Charact(27) + ""[6w""
 
iConfigure("epson")
iDestination(iPrinter, "test")
iEscape(INITPRNT)
iEscape(CPI10+CR)
iEscape("TEST 10 CPI normal" + CR)
iEscape(CR)
iEscape(CPI15)
iEscape("TEST 15 CPI normal" + CR)
iEscape(CR)
iEscape("   end of tests" + CR)
iEndPrinting())
Component: wd300prn.dll
See also
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help