VCL Reference
Printer, Canvas, PageWidth, PageHeight Example
This example uses a button and a memo on a form. When the user clicks the button, the content of the memo is printed, with a 200-pixel border around the page. To run this example successfully, you must add the Printers unit to the uses clause of your unit.
procedure TForm1.Button1Click(Sender: TObject);
begin
with Printerdo
begin
begin
Doc;
Canvas.TextRect(Rect(200,200,PageWidth-200,PageHeight-200),
200, 200, Memo1.Lines.Text);
EndDoc;
end;
end;