SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ Print exact sizes

This 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;
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes