Procedure tform1.button1click (Sender: tobject );
VaR
F: textfile;
Begin
Assignfile (F, 'lpt1 ');
Rewrite (f );
Write (F, CHR (27) + '@'); // CHR (27) + '@' That is, ESC @ command
Writeln (F, 'test1 first line ');
Writeln (F, CHR (12); // move the paper to a new page
Flush (f );
Closefile (f );
End;
Procedure tform1.button2click (Sender: tobject );
VaR
F: textfile;
Begin
Try
Assignfile (F, 'lpt1 ');
Rewrite (f );
// Print the title
Writeln (F, CHR ($ 1b) + CHR ($40); // [initialize the printer
Writeln (F, CHR ($ 1b) + CHR ($72) + '1'); // set red print
Writeln (F, CHR ($ 1b) + CHR ($61) + '1'); // center print
Writeln (F, CHR ($ 1c) + CHR ($21) + '4'); // print the width
Writeln (F, 'click print ');
writeln (F, CHR ($ 1b) + CHR ($61) + '0'); // cancel center printing
// writeln (F, 'order No.: '+ fgroupid); // display the bill No. And Room No.
// writeln (F, 'room No.:' + rmname );
writeln (F, 'order No.: '+ '000000'); // display the bill No. And Room No.
writeln (F,' Room No: '+ 'error');
writeln (F, CHR ($ 1c) + CHR ($21) + '0');
writeln (F, 'print time: '+ datetimetostr (now);
writeln (F,' ------------------------------------------ ');
writeln (F, 'item name quantity unit price total ');
writeln (F,' ---------------------------------------- ');
// Print the ending mark
Writeln (F ,'----------------------------------------');
// Writeln (F, 'total: '+ currtostr (ftotalsum) + 'meta ');
Writeln (F, 'total: '+ '25 yuan ');
// Print and cut the paper
Writeln (F, CHR ($ 1D) + 'V' + CHR (66) + CHR (0); // Paper Cutting
Finally
Closefile (f );
End;
End;