Board index » delphi » Printing text files

Printing text files

Hi everyone,
Can anyone tell me how can I print a text file? I've tryed using
AssignPrn(FileName), but I don't want the printer to use the Windows device
driver font. I need as fast printing as possible.
Thanks in advance.
 

Re:Printing text files


Try this :-

procedure TForm1.Button1Click(Sender: TObject);
  Var
  Prn, S : String ;
  Handle : Integer ;
begin
  Prn := 'LPT1' ;
  Handle := FileOpen( Prn, fmOpenWrite Or fmShareDenyNone ) ;
  If Handle <= 0 Then
     Begin
     ShowMessage( 'Failed to Open ' + Prn ) ;
     Exit ;
  End;

  S := 'This is A Test' + #13 + #10 ;
  FileWrite( Handle, S[1], Length( S ) ) ;
  FileClose( Handle ) ;
end;

On Tue, 19 Jun 2001 15:54:12 +0200, "Jasmina"

Quote
<jasm...@magnalekta.com.mk> wrote:
>Hi everyone,
>Can anyone tell me how can I print a text file? I've tryed using
>AssignPrn(FileName), but I don't want the printer to use the Windows device
>driver font. I need as fast printing as possible.
>Thanks in advance.

Other Threads