Thank you for multiple replies.
My code sends only non-zero (screen) bytes to the printer.
I understand that the Win-printing system may have to (or is geared) to send/specify all bytes to print on the paper; and that therefore 50 MB is warranted. MS Paint would be slaved to that too, but it isn't. What trick does it do to avoid this? It is curious that MS Paint needs to be manually scaled to about 90% for it to be able to put a 1024x768 screen shot on a 8.5x11 inch sheet of paper...
My coed uses the TPrinter object..
procedure TRMH7.PrntScrn1Click(Sender: TObject);
var w : integer;
print_size: integer;
procedure fill_printer_map;
var py, y : integer;
procedure one_scan; var i, ii, x, p, px: integer;
begin
px := (printer.pagewidth-(w*RMH7.ClientWidth))div 2;
x := 0;
repeat
p:= Imag1.Image1.canvas.Pixels[x,y];
if p <> bak_color then begin
printer.Canvas.Pixels[px,py] := p;
for i := 0 to 4 do
for ii := 0 to w-1 do begin
printer.Canvas.Pixels[px+i,py+ii] := p;
inc(print_size,1) end end;
px := px+w; x := x+1;
until x >= RMH7.ClientWidth;
py := py+w
end;{ one_scan}
begin{fill_printer_map}
print_size := 0;
py := (printer.pageheight-(w*RMH7.ClientHeight))div 4;
py := py*3;
for y := 0 to RMH7.ClientHeight-w do begin
one_scan;
if y mod 100 = 0 then Caption := Caption+'.' end; {for y }
end;{fill_printer_map}
procedure CopyToClipboard;
var MyRect :TRect;
begin
Imag1.Image1.ClientHeight := RMH7.ClientHeight;
Imag1.Image1.ClientWidth := RMH7.ClientWidth;
MyRect := Rect(0,0,RMH7.ClientWidth,RMH7.ClientHeight);
Imag1.Image1.Canvas.CopyRect(MyRect,RMH7.Canvas,MyRect);
Clipboard.Open;
Clipboard.Assign(Imag1.Image1.Picture.Bitmap);
MyRect := Rect(0,0,Imag1.Image1.ClientWidth,Imag1.Image1.ClientHeight);
Imag1.Canvas.CopyRect(MyRect,Imag1.Image1.Canvas,MyRect);
Clipboard.close end {CopyToClipboard};
begin {PrntScrn1Click}
printer.Printers.Text;
printer.Orientation := poLandscape;
w := printer.pagewidth;
w := w div RMH7.ClientWidth;
w:= Int_lesser_of(w,printer.pageheight div RMH7.ClientHeight);
RMH7.AutoRefresh.Enabled := false;
{ RMH7.Stat_AutoCycle.Caption := 'AutoCycle: OFF';
} MyMtrx^.old_caption := Caption;
RMH7.AutoRefresh.enabled := false;
{ if RMH7.AutoRefresh.enabled = true then
Stat_AutoCycle.Caption
:= 'AutoCycle: '+inttostr(AutoRefresh.Interval div 1000)
else Stat_AutoCycle.Caption := 'AutoCycle: OFF';
} Caption := 'Print Screen: Printing '
+inttostr(ClientHeight*ClientWidth)+' symbols. Please wait..';
CopyToClipboard;
printer.Title := copy(MyASCIIfile,length(MyASCIIfile)-10,10);
if PrintDialog1.Execute then begin
printer.BeginDoc;
fill_printer_map;
printer.EndDoc;
Info_Msg('RMH7 finished sending Screen Print to '
+#13+#10+'Windows AND your Printer has accepted complete control.'
+#13+#10+'The size of the Screen Data delivered was: '+inttostr(print_size div 1000)+'KB'
+#13+#10+'RMH7 is now ready to do more charting.');
end;
RMH7.Caption := MyMtrx^.old_caption;
end;{PrntScrn1Click}
BTW: found PrintWiz. In demo mode it works fast like MS Paint; and it is written in Delphi. However only the .EXE file is available; and author and his website have been neglected/abandoned since 2006....
Mani tnx,
RonQ