TM Windows Driver Examples using
Visual Basic Code
The following
example code fragments are provided as a guide to illustrate the control of
the printer via Visual Basic. Other Windows programming languages may use
similar syntax. Please refer to the Win32 API for the correct syntax.
Selecting
the Printer Driver:
The following
code establishes the specified printer driver as your "default printer."
'Set the
specified printer driver as the "default printer."
'The name in
quotes should match the Windows Printer Name exactly
For Each
prnPrinter In Printers
If
prnPrinter.DeviceName = "EPSON TM-200B No cut"
Then
Set Printer
= prnPrinter
Exit For
End If
Next
Selecting
the Paper Source:
The
following code will set or change the selected paper source on the printer.
'Selecting the
paper source.
Printer.FontSize
= 10 'Set up the font size.
Printer.FontName
= "control" 'Select the control font
Printer.Print
"3 " 'Specify the desired
source...see below comment.
'Print
something.
Printer.FontSize
= 10 'Select the text font size.
Printer.FontName
= "20 cpi" 'Select the
text font.
Printer.Print
"test print" 'Enter and print the text string.
'1: Journal
'2: Receipt
'3: Both
Cutting the Paper:
The following
code causes the printer to cut the paper.
Printer.FontSize
= 10 'Set up the control font.
Printer.FontName
= "control" 'Control Font.
Printer.Print
"F" 'Use special-function character to cut the
paper.
Printer.EndDoc
'F: Full cut
'P: Partial cut
Opening
the Cash Drawer:
The next example
shows how to open the desired cash drawer at the desired speed.
Printer.FontSize
= 10 'Set up the control font.
Printer.FontName
= "control"
Printer.Print
"A" 'Use special-function character to open
the cash drawer.
Printer.EndDoc
'A: Open
drawer 1 at 50ms.
'B: Open
drawer 1 at 100ms.
'C: Open
drawer 1 at 150ms.
'D: Open
drawer 1 at 200ms.
'E: Open
drawer 1 at 250ms.
'a:
Open drawer 2 at 50ms.
'b:
Open drawer 2 at 100ms.
'c:
Open drawer 2 at 150ms.
'd: Open
drawer 2 at 200ms.
'e:
Open drawer 2 at 250ms.
Please refer to the driver User's Manual
included with the TM Windows Driver Set for further examples and explanations.
The TM Windows Driver Set also includes a complete functional Visual Basic
sample application.
Here is a link to the latest Epson TM Series
printer drivers for Windows -
http://pos.epson.com/pointofsale/Tdr161e.exe