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

Conditionnal new page

edited March 2003 in General
I have a detail sub-report that consist of a list of image (tppImage loaded
in the BeforeGenerate event of the Detail band).

The images has MaintainedAspectRatio to True, and Stretch to true. The
images size vary in height, but not in width. I get very good results if I
print every images on a different page (group set on the ID and New page
on). For this, I set the TppImage to take the whole area of the page
(approx 8 inch by 11 inch).

Now I need to print many of them on the same page if the size permits it.
Usually, 3 of them need to be printed on the same page, but sometimes, the
image may take the whole page or half of the page.

How can I tell the report to print the image on another page if it is too
big to fit in the rest of the page?

--
Fred.
"People that think they know everything are a great annoyance to those of us
who do."
-Isaac Asimov

Comments

  • edited March 2003
    The report engine should print the images on pages if they can fit on the
    current page.Set ShiftWithParent to true on the image. If you can't get it
    to work, then send a report with a few images on it that show the problem to
    support@digital-metaphors.com and we'll debug it and get you a solution.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited March 2003
    > The report engine should print the images on pages if they can fit on the
    to

    My question was not clear. The real problem is that my images aren't all
    the same format and I need the to be streched to make them printable.
    Setting Strech to true and MaintainAspectRatio to true make the images to
    never have a bigger width, but reduce when the image is big. To solve this,
    I have to set the size of the ppimage to the full size of the page. If I set
    it to a smaller height, the image is very small because of the
    MaintainAspectRatio.

    How can I set the TppImage Height depending on the source image size? I am
    able to get the image size when I load it in the ppimage, but it is in
    pixels. I want to keep the report's units to utInches.
  • edited March 2003
    One solution is to load the image into an offscreen bitmap, check the
    dimensions, and set the TppImage.Height at runtime. This way Stretch can be
    set to false. Use the Detailband.BeforePrint event in order to set the
    height of the TppImage


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited March 2003
    I am able to get the image size when I load it in the ppimage, but it is in
    pixels. I want to keep the report's units to utInches.

    How do I convert pixels to inches? It has to work with different printer
    settings (resolutions) and different images sources.
  • edited March 2003
    Yes, you can convert report units. See the ppUtils.pas file for two
    functions ppFromMMThousandths and ppToMMThousandths. You can use these units
    to convert to and from microns to screen pixels or printer pixels to report
    units and back. For example:

    uses
    ppTypes;

    procedure TmyClass.Foo;
    var
    ldHeight: Double;
    begin
    ppToMMThousandths(ldHeight, ppReport1.Units, pprtVertical,
    ppReport1.Printer);
    ...

    --
    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.