Resizing TppImage to fit on report
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
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
This discussion has been closed.
Comments
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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