Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Resizing TppImage to fit on report

edited July 2010 in General
I need to be able to resize an image so that it fits on a report
correctly. As this is an application we deploy to our customers, I
can't hard code what size the image will be. I've looked all over for
some example code but I can't seem to find anything.

- I'm loading the images from a database table and printing multiple
per report, a group of images will be part of the detail band.
- If an image is smaller than the page width & height, then just print
it as is.
- If the image is larger than the page I want to resize it smaller to
fit the page, not crop it.
- the user needs to be able to select portrait or landscape, so I need
to check height & width vs paper size and resize it accordingly.

I've got a basic demo working now that handles printing jpg, gif & bmp
- but if the image is too large it causes issues.

We're currently using RB 10.07 and Delphi 2007.

Thanks,
Rich Werning

Comments

  • edited July 2010
    Hi Rich,

    If you set the TppImage or TppDBImage component to Stretch, the image should
    automatically shrink to the size of the component itself. All you need to
    do is ensure the image component is sized correctly based on the page width
    and height.

    Note that for RB 12, we enhanced the anchor feature allowing components to
    stretch themselves based on the size of the page so there would be no need
    to resize the image component manually.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2010
    Thanks for the info, I'll give that a shot.

    With the rewrite we're doing for our application in D2010 we'll be
    upgrading to RB 12, but this needs to be done in a service pack. I
    really don't like upgrading controls in service packs, more possible
    points of failure.

    - Rich

This discussion has been closed.