Re: printing: page eject

Posted by webmaster Guido on March 24, 2008

In Reply to Re: printing a RichEdit box posted by RussCAp12602 on March 21, 2008

: Is there a way to force a page eject during printing? In the "old days" one could put a Form Feed control character in the data to do this, but I doubt it is so simple now.

If you use the RichEdit.Print procedure as my previous code example, then the page ejecting is done automatically after the RichEdit is printed.

If you directly want to control the printing (for example, print some text and afterwards eject the page), you call Printer.BeginDoc to start a print job, next output the text with Printer.Canvas.TextOut, and finally print and eject the page with Printer.EndDoc. Note that the printing won't actually start until EndDoc is called:

  Printer.Canvas.Font.Name := 'Times New Roman';
  Printer.Canvas.Font.Size := 12;
  Printer.Canvas.TextOut(50, 50, 'This is line 1.');
  Printer.Canvas.TextOut(50, 70, 'This is line 2.');
  Printer.EndDoc; // prints and ejects the page

Related articles


Follow Ups