POS打印机一些特殊控制

耗尽温柔 提交于 2020-01-03 04:37:53

procedure TForm1.Button1Click(Sender: TObject);
var
RPrinter:TextFile;
i:integer;
begin

{设置打印机}
Assignfile(RPrinter,'lpt1');

{准备写文件}
Rewrite(RPrinter);

{打印}
for i := 0 to memo1.lines.Count - 1 do
Writeln(RPrinter,memo1.lines[i]);

{向后倒纸}
Writeln(RPrinter,chr($b)+chr(27)+'K'+chr(40));

{向前进纸}
Writeln(RPrinter,chr($b)+chr(27)+'J'+chr(140));

{开钱箱}
writeln(f,CHR(27)+CHR(112)+CHR(0)+CHR(17)+CHR(8));
write(f,CHR(27)+CHR(112)+CHR(0)+CHR(17)+CHR(8));
Chr(27)+'p'+chr(0)+chr(60)+chr(255)

{关闭打印机}
CloseFile(RPrinter);
end;

 

如何检测“LPT1” 端口是否可以用!

var
H: THandle;
begin
H := CreateFile('LPT1',0,0,nil,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,0);
if H <> INVALID_HANDLE_VALUE then
ShowMessage('可用');
end;

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!