Difference between revisions of "Print Bitmap"
From Lazarus wiki
Jump to navigationJump to searchm |
m (Fixed syntax highlighting) |
||
Line 2: | Line 2: | ||
==How to send an image to the printer== | ==How to send an image to the printer== | ||
− | <syntaxhighlight> | + | |
+ | <syntaxhighlight lang=pascal> | ||
// uses Printers; | // uses Printers; | ||
var | var | ||
Line 22: | Line 23: | ||
end; | end; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− |
Latest revision as of 08:54, 23 February 2020
│
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;