Print images. Document size problem.

From: Zamorano (ama593_at_alboran.ual.es)
Date: 10/29/03


Date: 29 Oct 2003 09:54:16 -0800

I´m trying to print a typical JPG image (320x240) on my printer. It
must be stretched in order that the width of my image fits with the
width of the page.

I have write a simple code that works fine. It is like this:

procedure ImprimirImagen(imagen: TJPEGImage)
var
   AspectRatio: Single;
   OutputWidth, OutputHeight: Single;
begin
   Printer.BeginDoc;
   try
      OutputWidth := Printer.PageWidth
      AspectRatio := imagen.Width / imagen.Height;
      OutputHeight := OutputWidth / AspectRatio;
      Printer.Canvas.StretchDraw(Rect(0, 0, Trunc(OutputWidth),
Trunc(OutputHeight)), imagen);
   finally
      Printer.EndDoc;
   end;
end;

As I have already said, it works fine, but there is a problem. This
code send the image to the printer VERY SLOW because the print
document that generates is huge. My 320x240 jpg generates a print
document of about 4MB. When the printer is locally connected is only a
bit slow but when it is remote it takes about 30 secs to print the
image.

It seems like StretchDraw converts my little picture to a big one (the
size of the page 2892x1972) before sending it to the printer.

I supose that you can write a small photo in the printer at big size
without making a big document, so it would be very fast if my document
takes KB nor MB

Is this possible? Anyone know how?