Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

Print Bitmap

English · Français · Русский

How to send an image to the printer

pascal
// 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;

From the Free Pascal wiki, page "Print Bitmap", as it stood on 2020-02-23 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .