You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Keiron Liddle <ke...@aftexsw.com> on 2002/07/08 12:27:02 UTC

Re: how to use org.apache.fop.layout.AreaTree

Hi Baptiste,

What exactly are you trying to achieve.
If you want to find out the size of the table that is only known at
layout time. The layout is done at the end of the page sequence so if
you are hoping to alter some fo object (through SAX or whatever) after
the table is laid out then it will be too late.

The height of the table is available from the Area that the table
creates. There are probably a number of hacks you could do...

Are you sure you don't want to use a normal fo object such as
table-footer, footnote, region-after.

On Mon, 2002-07-08 at 09:58, Baptiste Burgaud wrote:
> 
> Hi all,
> 
> I'm not sure whether this is the right list or not (I already posted this mail to the fop-user list, but no one did answer). Please excuse me if you find this mail inappropriate.
> I need to get the accurate rendered height (in pt) of a fo:table object (to place fo:blocs below using fo:block-container with absolute position). I think I can get this size adding the getContentHeight() result of the appropriate areas in the org.apache.fop.layout.AreaTree object (initially _areaTree in Driver class). Unfortunately, I don't have much time to look around in FOP source, does someone know how where and when (!...) I should get this object? Is it possible within the FOP API (I certainly won't risk a rebuild...)?
> 
> thxs in advance, Baptiste



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: how to use org.apache.fop.layout.AreaTree

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Mon, 2002-07-08 at 15:14, Baptiste Burgaud wrote:
> True! Actually I surfed again fop website and I found
> http://xml.apache.org/fop/design/understanding/renderers.html where is
> explained how to add a new renderer. So it's what I'm doing to get this Area
> you talked about. This should work and seems "cleaner" to me than rebuiding
> fop. I will simply call the render method of a "fake" driver with some
> sample data (the table first column) and then use the real driver. The table
> area must be the highest AreaContainer. Does all of this seems correct to
> you?

That is something that could work for your situation. You can get the
information from each area and change it on the area that needs to be
placed in a particular position.

Not a method I would normally recommend but if you have to do it.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: how to use org.apache.fop.layout.AreaTree

Posted by Baptiste Burgaud <Ba...@cgey.com>.
Hi Keiron,

thanks for your reply.

> What exactly are you trying to achieve.
I'm trying to get the exact rendered size of a table. The problem is that
table cells are as high as the text blocks they contain, even if I set the
height table-cell or table-row attribute. I tried to use the padding as a
workaround but this leads to approximation errors.

> Are you sure you don't want to use a normal fo object such as
> table-footer, footnote, region-after.
I'm sure I can't : All my fo objects (tables, text blocks, images) are
independently placed in the page using fo:block-container with absolute
position and I can't handle this differently beacause of the way my fo is
generated.

> The height of the table is available from the Area that the table
> creates. There are probably a number of hacks you could do...
True! Actually I surfed again fop website and I found
http://xml.apache.org/fop/design/understanding/renderers.html where is
explained how to add a new renderer. So it's what I'm doing to get this Area
you talked about. This should work and seems "cleaner" to me than rebuiding
fop. I will simply call the render method of a "fake" driver with some
sample data (the table first column) and then use the real driver. The table
area must be the highest AreaContainer. Does all of this seems correct to
you?

regards, Baptiste.

---------------------------------------------------------------
import org.apache.fop.apps.Driver;
import org.apache.fop.render.Renderer;

public class FakeDriver extends Driver
{
    /**
     * FakeRender, to compute table height
     */
    public static final int FAKE_RENDER = 10;

    public void setRenderer(int renderer) throws IllegalArgumentException
    {
      if(renderer==FAKE_RENDER) setRenderer(new FakeRenderer());
        else super.setRenderer(renderer);
    }
}
---------------------------------------------------------------

import org.apache.fop.render.pdf.PDFRenderer;
import org.apache.fop.layout.AreaContainer;

public class FakeRenderer extends PDFRenderer
{
    public void renderAreaContainer(AreaContainer area)
    {
      //some code to handle size...
      super.renderAreaContainer(area);
    }
}

----- Original Message -----
From: "Keiron Liddle" <ke...@aftexsw.com>
To: "FOP" <fo...@xml.apache.org>
Sent: Monday, July 08, 2002 12:27 PM
Subject: Re: how to use org.apache.fop.layout.AreaTree


> Hi Baptiste,
>
> What exactly are you trying to achieve.
> If you want to find out the size of the table that is only known at
> layout time. The layout is done at the end of the page sequence so if
> you are hoping to alter some fo object (through SAX or whatever) after
> the table is laid out then it will be too late.
>
> The height of the table is available from the Area that the table
> creates. There are probably a number of hacks you could do...
>
> Are you sure you don't want to use a normal fo object such as
> table-footer, footnote, region-after.
>
> On Mon, 2002-07-08 at 09:58, Baptiste Burgaud wrote:
> >
> > Hi all,
> >
> > I'm not sure whether this is the right list or not (I already posted
this mail to the fop-user list, but no one did answer). Please excuse me if
you find this mail inappropriate.
> > I need to get the accurate rendered height (in pt) of a fo:table object
(to place fo:blocs below using fo:block-container with absolute position). I
think I can get this size adding the getContentHeight() result of the
appropriate areas in the org.apache.fop.layout.AreaTree object (initially
_areaTree in Driver class). Unfortunately, I don't have much time to look
around in FOP source, does someone know how where and when (!...) I should
get this object? Is it possible within the FOP API (I certainly won't risk a
rebuild...)?
> >
> > thxs in advance, Baptiste
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org