TPreview v4.74

Post here your experiences, comments, suggestions, or bug reports regarding to the DELPHI AREA products. Not-matching topics will be moved or deleted.

TPreview v4.74

by beinars » 19/10/10 11:28

Hi there and thanks again for this great product..

I have been using this unit with some modification, which are mostly towards report abilities or higher level use. Until now I haven't sunk myself into the deep forest of this code.

I have stumped onto wall, as in some cases where graphic (bitmap) printing results as black box! This happens even with only when printing one page.

It looks like as it relates to the size of the bitmap somehow. I have tried to search for this kind of problem here on this forum, but with no luck.

As I said, I suspect this problem relates to "upload time", size and even printer more than this code or methods using when printing. Quick glans at the problem points out HP-printers more than others brand. But the stat set is of low value, under 10 individuals.

If you have any suggestion I would appreciate it very much.

ps. ..isn't possible to donate some $$
beinars
Active Member
Active Member
 
Posts: 10
Joined: 03/05/07 09:38
Location: Iceland

Re: TPreview v4.74

by Kambiz » 19/10/10 12:57

Do you use PaintGraphic, PaintGraphicEx, or PaintGraphicEx2 method to draw the bitmaps? If the answer is positive, please send me one the bitmaps, so that I can investigate the problem.

By the way, why using v4.74? The latest version is v5.5! Instead of modification, if you drive your own preview class from TPrintPreview, you can always use the latest version of the component, mostly without need to revise your code.

Thanks for offering $! I'm leaving in an isolated country, and no financial interaction with the outside world is possible.
Kambiz

Donate a cup of food for free: Click to Give @ The Hunger Site
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2013
Joined: 07/03/03 19:10
Location: Tehran, Iran

Re: TPreview v4.74

by beinars » 19/10/10 14:14

Tanks Kambiz

I use this function: PaintGraphicEx (R_To, Image1.Picture.Graphic, false, False, false);

As you can see I send Graphic as parameter.

That function use this code to print graphic:

Code: Select all
    Bitmap := TBitmap.Create;
    try
      Bitmap.Canvas.Brush.Color := clFuchsia;
      Bitmap.Width := Graphic.Width;
      Bitmap.Height := Graphic.Height;
      Bitmap.Canvas.Draw(0, 0, Graphic);
      Bitmap.Transparent := Graphic.Transparent;
      DrawBitmapAsDIB(Canvas.Handle, Bitmap, Rect)
    finally
      Bitmap.Free;
    end;


And by the way. It doesn't happen every time of printing. Indeed it happens rather rarely, which why I can't debug it and solve it by myself.

And I will download the newest version. Most likely I will update my version by using source comparison as I see I have modified the TPreview comp in some cases.. and perhaps most likely to worse!

Again, thanks!
beinars
Active Member
Active Member
 
Posts: 10
Joined: 03/05/07 09:38
Location: Iceland

Re: TPreview v4.74

by Kambiz » 19/10/10 17:02

I can see that the problem is because of image transparency.

First, make sure AllowTransparentDIB global variable (declared in Preview.pas) is set to False.

After that, either set background color of your bitmap to white and set its Transparent property to False, or use these steps to draw the bitmap properly:

  1. Create a temporary bitmap as size as the original one
  2. Fill the background of the temporary bitmap with white color
  3. Draw the original bitmap on the temporary one
  4. Draw the temporary bitmap on the print preview's canvas
  5. Free the temporary bitmap

FYI, I just uploaded a new release of the component.
Kambiz

Donate a cup of food for free: Click to Give @ The Hunger Site
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2013
Joined: 07/03/03 19:10
Location: Tehran, Iran


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 0 guests