Print Bitmap

From Free Pascal wiki
Jump to navigationJump to search

English (en) français (fr) русский (ru)

How to send an image to the printer

// uses Printers;
var
  Scale :LongInt;
begin
  with Printer do
    begin
      BeginDoc;
      Scale := Min(
        Printer.PageWidth div Image1.Picture.Bitmap.Width,
        Printer.PageHeight div Image1.Picture.Bitmap.Height);

      Printer.Canvas.StretchDraw(
        Rect(0, 0, Image1.Picture.Bitmap.Width*Scale, Image1.Picture.Bitmap.Height*Scale),
        Image1.Picture.Bitmap);

      EndDoc;
    end;
end;