Beranda > Delphi > How to print text and text files in Delphi

How to print text and text files in Delphi

This code how to print text and text files. This is the simplest way to print without using any external functions. All you have to do is open the LPT1 port (this is the default printer port) as if it where a file.

This code can be easily ported to Turbo Pascal (just change the function and variable type names).

var
  fPrinter: TextFile;
begin
  AssignFile(fPrinter, 'LPT1');
  Rewrite(fPrinter);
  { Write your printing code here. For files you may want to use a "for"
    or "while not Eof(fPrinter)" statement.
    Example: WriteLn(fPrinter, 'The text you want to print.'); }
  CloseFile(fPrinter);
end;
Iklan
Kategori:Delphi
  1. Belum ada komentar.
  1. No trackbacks yet.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: