'Set the specified printer driver as the "default printer."
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.
"Carlos Aneses" <carl...@prtc.net> wrote in message
news:3be84868_2@dnews...
var
i: integer;
begin
// Set the specified printer driver as the current printer.
for i := 0 to Printer.Printers.Count - 1 do begin
if Printer.Printers[i] = 'EPSON TM-200B No cut' then begin
Printer.PrinterIndex := i;
end;
end;
end;
Printing is a little bit more problematic:
Printer.BeginDoc;
Printer.Canvas.Font.Size := 10; // Set up the font size
Printer.Canvas.Font.Name := 'control'; // Select the control font
Printer.Canvas.TextOut(0,0,'Hello, world!'); // Print some text
Printer.EndDoc;
The problem is that to print different lines you have to keep record
of the coordinates and meassure the height of the text to advance
the coordinates to a new line... It is also possible to print with
Writeln to a text file assigned to the printer device... Anyway, to
print the old fashioned way (printing lines) I would suggest you to
use YAPI instead: http://www.geocities.com/yapisoftware/
Ernesto D'Spirito
Editor, Pascal Newsletter
http://www.latiumsoftware.com/en/
"Carlos Aneses" <carl...@prtc.net> wrote in message
news:3be84868_2@dnews...