Author: Jonas Bilinkevicius How do I set the left margin when printing the contents of a TRichEdit? Answer: You can set TRichEdit.PageRect for the margins. Get the printer information with GetDeviceCaps. 1 2 procedure TForm1.Button1Click(Sender: TObject); 3 var 4 PixelsX, PixelsY: integer; 5 LeftSpace, TopSpace: integer; 6 R: TRect; 7 begin 8 if PrintDialog1.Execute then 9 begin 10 {get pixels per inch} 11 PixelsX := GetDeviceCaps(Printer.Handle, LOGPIXELSX); 12 PixelsY := GetDeviceCaps(Printer.Handle, LOGPIXELSY); 13 {get non-printable margins} 14 LeftSpace := GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX); 15 TopSpace := GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY); 16 {1' margin all around} 17 R.Left := Round(PixelsX * 1) - LeftSpace; 18 R.Right := Round(PixelsX * 7.5) - LeftSpace; 19 R.Top := Round(PixelsY * 1) - TopSpace; 20 R.Bottom := Round(PixelsY * 10) - TopSpace; 21 RichEdit1.PageRect := R; 22 RichEdit1.Print('Test'); 23 end; 24 end;