Board index » delphi » Printing bitmaps driving me mad in Delphi 4.

Printing bitmaps driving me mad in Delphi 4.

I cannot seem to get Delphi 4 to reliably print bitmaps. My code is as
follows:

  printer.BeginDoc;

  for i := 1 to 20 do
  begin

    printer.canvas.textout(100, 100 + 100*i, 'Printed directly using text
out ' + inttoStr(i));

    bm := tbitmap.create;
    try
      bm.handletype := bmDIB;
      bm.pixelformat := pf32bit;
      bm.width := 1000;
      bm.height := 100;
      bm.canvas.font.size := 40;
      bm.canvas.textout(0,0,'Printed indirectly using bitmap '
+inttostr(i));
      printer.canvas.draw(1500,100 + 100 * i,bm);
    finally
      bm.free;
    end;

  end;

  printer.EndDoc;

Clearly, this code should print two columns of text, the second column
having been printed as bitmaps.

The first column prints fine, however, randomly, some of the bitmaps in the
second column do not get printed. The same thing happens different
printers; when printing to Acrobat it crashes altogether.

I can't see what I'm doing wrong : please help!

Regards,

Jon Lane

 

Re:Printing bitmaps driving me mad in Delphi 4.


Quote
Eric Pedrazzi (www.chez.com/epedrazzi) wrote:

You may solve your problem or learn more about printing features on the
http://www.efg2.com/lab web pages, in the Printer Projects Section.

Bye. Eric.

Jonathan Lane <j...@ani.co.uk> a crit dans le message :
01bec862$c44a33a0$0200a8c0@jon...

Quote
> I cannot seem to get Delphi 4 to reliably print bitmaps. My code is as
> follows:

>   printer.BeginDoc;

>   for i := 1 to 20 do
>   begin

>     printer.canvas.textout(100, 100 + 100*i, 'Printed directly using text
> out ' + inttoStr(i));

>     bm := tbitmap.create;
>     try
>       bm.handletype := bmDIB;
>       bm.pixelformat := pf32bit;
>       bm.width := 1000;
>       bm.height := 100;
>       bm.canvas.font.size := 40;
>       bm.canvas.textout(0,0,'Printed indirectly using bitmap '
> +inttostr(i));
>       printer.canvas.draw(1500,100 + 100 * i,bm);
>     finally
>       bm.free;
>     end;

>   end;

>   printer.EndDoc;

> Clearly, this code should print two columns of text, the second column
> having been printed as bitmaps.

> The first column prints fine, however, randomly, some of the bitmaps in
the
> second column do not get printed. The same thing happens different
> printers; when printing to Acrobat it crashes altogether.

> I can't see what I'm doing wrong : please help!

> Regards,

> Jon Lane

Other Threads