Articles

his example shows how to print a bitmap with specified printing area.

uses Printers;
...
procedure TForm1.Button1Click(Sender: TObject);
var
  Rec: TRect;
  Rate: Double;
begin
  Image1.Picture.LoadFromFile('factory.bmp');
  Rate:=Image1.Picture.Height/Image1.Picture.Width;
  Rec:=Rect(
    5,
    5,
    Printer.PageWidth-5,
    Trunc(Printer.PageHeight*Rate-
      GetDeviceCaps(Printer.Handle,LOGPIXELSX))-5);
  Printer.BeginDoc;
  Printer.Canvas.StretchDraw(Rec,Image1.Picture.Graphic);
  Printer.EndDoc;
end;