Impressao - assignprn |
Top Previous Next |
|
// Exemplo de impressão usando o AssignPrn // Modo gráfico. Teste usando uma GENERICA/SOMENTE TEXTO que ACHO que // vai ficar no modo texto uses Printers;
procedure TForm1.Button1Click(Sender: TObject); var I: Integer; begin ListBox1.Items.Clear; for I:= 1 to Printer.Printers.Count do begin if Pos('LPT', printer.Printers.Strings[I-1]) > 0Then ListBox1.Items.Add('LPT1') else if Pos('\\', printer.Printers.Strings[I-1]) > 0 Then ListBox1.Items.Add(Copy(printer.Printers.Strings[I-1],Pos('\\', printer.Printers.Strings[I-1]),length(printer.Printers.Strings[I-1]) - Pos('\\', printer.Printers.Strings[I-1]) + 1)); end; end;
procedure TForm1.Button2Click(Sender: TObject); var I : Integer; Arquivo: TextFile; begin Printer.PrinterIndex := Listbox1.ItemIndex; Caption := Printer.Printers[Printer.PrinterIndex];
AssignPrn(Arquivo); Rewrite(Arquivo); WriteLn(Arquivo, #27#80#18); for I := 1 to 40 do WriteLn(Arquivo, '12345678901234567890123456789012345678901234567890 + ' + TimeToStr(Time));
CloseFile(Arquivo); end; |