I can't seem to be able to print bitmaps reliably in Delphi 4. My code is as follows:
procedure TForm1.BitBtn1Click(Sender: TObject);
i : integer;
bm : tbitmap;
for i := 1 to 20 do
bm := tbitmap.create;
bm.handletype := bmDIB;
bm.pixelformat := pf32bit;
bm.width := 1000;
bm.height := 100;
bm.canvas.font.color := clBlack;
bm.canvas.font.size := 40;
bm.canvas.font.name := 'ARIAL';
bm.canvas.textout(0, 0, 'Using tbitmap ' +inttostr(i));
printer.canvas.textout(1000, 100 + 100*i, 'Using textout ' + inttoStr(i));
printer.Canvas.Draw(100,100 + 100 * i,bm);
The printout should have two columns, the first with text printed via a tbitmap, the second with text printed directly. However, bitmaps in the first column seem to randomly go missing. I've tried using an HP Laserjet 6L and an IBM 4039 LaserPrinter Plus both with the same result. Using Acrobat 2.11 writer causes a GPF.
Is there something wierd going on here, or am I being totally stupid?
Any help would be greatly appreciated.