unit PrintExample;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    RichEdit1: TRichEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: PrintExample
// Method: ComCtrls.TCustomRichEdit.Print

// BeginCode
{
Place a button and a richedit on the form.  No print dialog
appears.  The contents of the richedit is printed to the
currently configured printer.
}
procedure TForm1.FormCreate(Sender: TObject);
const
  // The path may need to be changed to accommodate
  // locations of files on your system.
  Path = 'OVERVIEW.RTF';
begin
   RichEdit1.Lines.LoadFromFile(Path);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  // The parameter string shows in the print queue
  // under "Document/name".
  RichEdit1.Print('My Document Name');
end;
// EndCode
// EndExample: PrintExample
end.
