#1 PDF Engine » MormotReport is making black images in PDF » 2013-09-17 10:00:40

Patacon
Replies: 2

I'm having a weird problem with MormotReport.pas creating pdf files.  I use the unit to print to a pdf file (at most) 6 images using DrawBMP.  The first One is always fine, the rest of them, sometimes just print a black box the size of the image.  Usually 1 and 3 are fine, 2,4,5,6 are black.  I Verified the source of the graphics saving to disk the image after printing to pdf  and allways works fine.  I tried to use PDF.ForceNoBitmapReuse := True without any luck (bigger files but same black boxes).  I also tried using 6 different bmp vars, creating bmp before every image print and freeing the bmp var after printing with no luck.  Some little changes make results change.  Printing a lot of texts after o before every image, o printing a very small bmp before the normal ones tends to print more correct images but not all of them.   If I try a step by step run, the program works fine, so I can not see why is not working.  Thank you in advance for anything you can do to help me.... (ps. sorry for my bad English).

          ...   Basically I repeat this block six times with 6 different images...

           Bmp := TBitmap.Create;
           Form1.Image1.Picture.LoadFromFile('Fondo5.jpg');
           Bmp.Width := Form1.Image1.Picture.Width;
           Bmp.Height := Form1.Image1.Picture.Height;
           Bmp.Canvas.Draw(0, 0,Form1.Image1.Picture.Graphic);
           NewPage(True);
                TextAlign := taJustified;

               DrawText(s);
                NewLine;

           DrawTitle('Imagen #'+IntTostr(i),true);
           NewLine;
           DrawBMP(bmp,maxint,180,'Imagen #'+IntTostr(i));
          //bmp.savetofile('test6.bmp'); <-- save a good file, so is not a problem with the bmp going wrong... 
          i := i +1;
        ...

Board footer

Powered by FluxBB