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 procedure TForm1.Button1Click(Sender: TObject); 2 var 3 PixelsX, PixelsY: integer; 4 LeftSpace, TopSpace: integer; 5 R: TRect; 6 begin 7 if PrintDialog1.Execute then 8 begin 9 {get pixels per inch} 10 PixelsX := GetDeviceCaps(Printer.Handle, LOGPIXELSX); 11 PixelsY := GetDeviceCaps(Printer.Handle, LOGPIXELSY); 12 {get non-printable margins} 13 LeftSpace := GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX); 14 TopSpace := GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY); 15 {1' margin all around} 16 R.Left := Round(PixelsX * 1) - LeftSpace; 17 R.Right := Round(PixelsX * 7.5) - LeftSpace; 18 R.Top := Round(PixelsY * 1) - TopSpace; 19 R.Bottom := Round(PixelsY * 10) - TopSpace; 20 RichEdit1.PageRect := R; 21 RichEdit1.Print('Test'); 22 end; 23 end;