Mega Code Archive

 
Categories / Delphi / Printing
 

Escape code lari printere nasıl gönderebilirim

uses Printers; procedure TForm1.Print1Click(Sender: TObject); var Line: Integer; PrintText: TextFile; {declares a file variable} begin if PrintDialog1.Execute then begin AssignPrn(PrintText); {assigns PrintText to the printer} Rewrite(PrintText); {creates and opens the output file} Printer.Canvas.Font := Memo1.Font; {assigns Font settings to the canvas} for Line := 0 to Memo1.Lines.Count - 1 do Writeln(PrintText, Memo1.Lines[Line]); {writes the contents of the Memo1 to the printer object} // now to send an escape code is as easy as Writeln(PrintText, #27); // #27 is the code for Escape // #27 is usually followed by your printers actual commands, e.g.. on my printer I use Writeln(PrintText, #27 + 'B1'); // to turn BOLD print on,and Writeln(PrintText, #27 + 'B0'); // to turn BOLD print off // but these codes most likely wont work on your printer :), check your manual for the actual ones CloseFile(PrintText); {Closes the printer variable} end; end;