procedure TForm1.Button1Click(Sender: TObject);
var
F:TextFile;
begin
Assignfile(f,'LPT1');
rewrite(f);
Write(f,chr(27)+'@'); //Chr(27)+'@' 即ESC @ 指令
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);
//打印标题
Writeln(F,chr($1b) + chr($40)); //[初始化打印机
Writeln(F,Chr($1b) + Chr($72) + '1'); //设置红色打印
Writeln(F,chr($1b) + chr($61) + '1'); //居中打印
Writeln(F,chr($1c) + chr($21) + '4'); //倍宽打印
Writeln(F,'点单打印');
Writeln(F,chr($1b) + chr($61) + '0'); //取消居中打印
//Writeln(F, '点单号:' + fGroupID); //显示帐单号,房号
//Writeln(F, '房 号:' + RmName);
Writeln(F, '点单号:' + '23232'); //显示帐单号,房号
Writeln(F, '房 号:' + 'ereer');
Writeln(F,chr($1c) + chr($21) + '0');
Writeln(F,'打印时间:' + datetimetostr(Now));
Writeln(F,'----------------------------------------');
Writeln(F,' 商品名称 数量 单价 单位 合计');
Writeln(F,'----------------------------------------');
//打印尾标
Writeln(F,'----------------------------------------');
// writeln(F,' 合计:' + CurrToStr(fTotalSum) + '元');
writeln(F,' 合计:' + '25元');
//打印完毕,切纸
Writeln(F,chr($1d)+ 'V' + chr(66) + chr(0)); //切纸
finally
closefile(F);
end;
end;
|
请发表评论