lgc5800
asked on
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,ima ge1.pictur e.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
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
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
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;
Try it with this code and look what happens :
procedure TForm1.Button1Click(Sender
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;
Does the error occures when you print with APIs?
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
from Delphi.HLP:
....some printers do not support graphics. Therefore, the Draw, StretchDraw, or CopyRect methods might fail on these printers.
....some printers do not support graphics. Therefore, the Draw, StretchDraw, or CopyRect methods might fail on these printers.
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