EasyManuals Logo

Epson TM U295 - B/W Dot-matrix Printer User Manual

Epson TM U295 - B/W Dot-matrix Printer
45 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #41 background imageLoading...
Page #41 background image
TITLE
TM Printer Driver
SHEET
REVISION
NO
User's Manual
1.60
NEXT
42
SHEET
41
EPSON
6.2.7. Using ESC/POS commands
The following example shows how you can use the Win32 API to transmit ESC/POS commands directly to the printer. For
more details, refer to the Win32 API help information.
Public Type DOCINFO
pDocName As String
pOutputFile As String
pDatatype As String
End Type
‘'Win32 API external reference definitions
Public Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Public Declare Function EndDocPrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Public Declare Function EndPagePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Public Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" _
(ByVal pPrinterName As String, phPrinter As Long, ByVal pDefault As Long) As Long
Public Declare Function StartDocPrinter Lib "winspool.drv" Alias "StartDocPrinterA" _
(ByVal hPrinter As Long, ByVal Level As Long, pDocInfo As DOCINFO) As Long
Public Declare Function StartPagePrinter Lib "winspool.drv" _
(ByVal hPrinter As Long) As Long
Public Declare Function WritePrinter Lib "winspool.drv" (ByVal hPrinter As Long, _
pBuf As Any, ByVal cdBuf As Long, pcWritten As Long) As Long
‘##### Source Code #####
Dim lhPrinter As Long
Dim lReturn As Long
Dim lpcWritten As Long
Dim lDoc As Long
Dim sWrittenData As String
Dim MyDocInfo As DOCINFO
lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)
If lReturn = 0 Then
MsgBox "Open Printer Error!"
End If
MyDocInfo.pDocName = "SAMPLE"
MyDocInfo.pOutputFile = vbNullString
MyDocInfo.pDatatype = vbNullString
lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
Call StartPagePrinter(lhPrinter)
‘'Output ESC/POS commands and the string to be displayed
sWrittenData = Chr(&H1B) + "=" + Chr(&H2) 'Select the peripheral device.
sWrittenData = sWrittenData + Chr(&H1B) + "t" + Chr(&H0) 'Select the character code table.
sWrittenData = sWrittenData + Chr(&H1B) + "R" + Chr(&H0) 'Select international characters.
sWrittenData = sWrittenData + “SEIKO EPSON ESC/POS" 'String to be displayed.
lReturn = WritePrinter(lhPrinter, ByVal sWrittenData, Len(sWrittenData), lpcWritten)
lReturn = EndPagePrinter(lhPrinter)
lReturn = EndDocPrinter(lhPrinter)
lReturn = ClosePrinter(lhPrinter)

Other manuals for Epson TM U295 - B/W Dot-matrix Printer

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Epson TM U295 - B/W Dot-matrix Printer and is the answer not in the manual?

Epson TM U295 - B/W Dot-matrix Printer Specifications

General IconGeneral
BrandEpson
ModelTM U295 - B/W Dot-matrix Printer
CategoryPrinter
LanguageEnglish

Related product manuals