شما توسط اين کد مستقيما خطوط يک فايل رو به پورت پيرينتر ارسال ميکنيد تا چاپ شود


Code:

procedure TForm1.Button1Click(Sender: TObject);
var
port, prnfile: file;
buffer: array [1..128] of Char;
Read: Integer;
begin
AssignFile(prnfile, 'filetoprint');
Reset(prnfile, 1);
AssignFile(port, 'LPT1');
Rewrite(port, 1);
repeat
BlockRead(prnfile, buffer, SizeOf(buffer), Read);
BlockWrite(port, buffer, Read);
until EOF(prnfile) or (Read <> SizeOf(buffer));
CloseFile(prnfile);
CloseFile(port);
end;