Printing large bitmap with DELPHI 1/ NT4

I have a serious problem on DELPHI 1 on NT4 pack 3 with the command :
PRINTER.CANVAS.STRECHDRAW for a large bitmap.
Nothing is printing (9 / 10 tentatives) !



arect := rect(0,0,p1,p2); {p1 = 4000 and p2 = 3250}
with printer do
     begin
     begindoc;
   printer.canvas.stretchdraw(arect,image1.picture.graphic);
     enddoc;
     end;


This print is received by the printer manager (normally +- 700Kb)when printing is OK.
But when no print occurs, the size of the file is anormally little (approximatively 70Kb ?) an nothing is printed.

What append ?

Please HELP me.
Eric
sncb.cim.fl@skynet.be
lgc5800Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
OdieConnect With a Mentor Commented:
Hope it helped
0
 
d003303Commented:
Yo,

try to print to a file and have a look at the output when the printing fails. This may help you finding the error.

Slash/d003303
0
 
ZifNabCommented:
Hi lgc5800,

Try it with this code and look what happens :

procedure TForm1.Button1Click(Sender: TObject);
var
  ScaleX, ScaleY: Integer;
  R: TRect;
begin
  Printer.BeginDoc;  // **
  with Printer do
  try
    ScaleX := GetDeviceCaps(Handle, logPixelsX) div PixelsPerInch;
    ScaleY := GetDeviceCaps(Handle, logPixelsY) div PixelsPerInch;
    R := Rect(0, 0, Image1.Picture.Width * ScaleX,
      Image1.Picture.Height * ScaleY);
    Canvas.StretchDraw(R, Image1.Picture.Graphic);  // **
  finally
    EndDoc;  // **
  end;
end;

c.u. Zif;
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
MikeP090797Commented:
Does the error occures when you print with APIs?
0
 
OdieCommented:
Have you read the readme file?  I believe I had the same problem some time back - but I didn't read the readme file and it was explained there.
0
 
kruglovCommented:
from Delphi.HLP:
....some printers do not support graphics. Therefore, the Draw, StretchDraw, or CopyRect methods might fail on these printers.
0
All Courses

From novice to tech pro — start learning today.