You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by asitha w <in...@gmail.com> on 2010/07/07 12:36:58 UTC

Problem with keep-with-next="always" and keep-with-previous="always" fop 0.20.5

Hi every one, I’m facing a problem with keep-with-next="always" and
keep-with-previous="always" properties

The fop version that I’m dealing with is 0.20.5



The problem:

Whenever table contains table header* and if a row contains data that does
not fit to a single page, and if this row is added to a keep-with-next list
or a keep-with-previous, the table get corrupted. Eg: the whole table get
printed in a single page overlapping the footer.



EG

 _________________________________

|   TABLE HEADER                  |

|_________________________________|

|row 1 - keep-with-next="always"  |

|_________________________________|

|row 2 - keep-with-next="always"  |

|_________________________________|

|row 3 - keep-with-next="always"  |

|_________________________________|

|row 4 - keep-with-next="always"  |

|_________________________________|





Seems that when this is the case. all rows are added to a single array list
and finally dropped to the page, and when one row contains a row which is
larger than the page (eg row 2). It creates a one single page overflowing
the page footer to the very end of the page.



And if we disconnect the keep with array. Eg remove keep-with-next from the
 row 1, all works as expected!



It seems that, if the first row of the table is joined with a keep-with list
and if this list contains larger than page row this error will come. Seems
to be that one row must be laid solidly on the page in order to keep-with
larger than page rows to be work.



Did anyone else faced the same when using fop 0.20.5 ?

Can someone point me where in fop code should I look for calculating and
splitting according to the remaining page height vs. largest cell height?

(org.apache.fop.fo.flow. TableRow. Layout ?)



What I want to do is, check if the remaining height is not enough move to
the next page. Print as much as possible then *continue to the next. Whats
happening is it just move to the next page and dump all the content in the
next page.



Thanks in advance

Asitha.

Re: Problem with keep-with-next="always" and keep-with-previous="always" fop 0.20.5

Posted by asitha w <in...@gmail.com>.
Hi,



I’m (we are) stuck with this ancient version of FOP.

@Chris updating the fop version is not an option rite now.



I did spend a considerable time with the fop code. I do have sort of 80%
working solution to my problem. I will post it here just in case someone
form the past like me find it helpful.



Class: org.apache.fop.fo.flow.TableRow

Method: public int layout(Area area);



Add another check where you update the largest cell height.

…

} else if (h > largestCellHeight) {

                largestCellHeight = h;

<fix_start>

                if(largestCellHeight>spaceLeft)

                {

                    this.resetMarker();

                    this.removeID(area.getIDReferences());

                    return Status.AREA_FULL_NONE;

                }

<fix_end>

}

…



This will simply skip the current page and move on to the next page.  But I
still have some black box area with this solution. eg how does the original
keep with properties get  dropped.

Not happy but gotta live with this until we decide to update the FOP.



Side effects of the above workaround.

It will add a blank page, before the keepwith list, anyone know how to
remove already added page from the output.



Anyways

Thanks everyone for reading this.


On Mon, Jul 12, 2010 at 4:27 PM, Chris Bowditch
<bo...@hotmail.com>wrote:

> asitha w wrote:
>
>>
>> Hi every one, I’m facing a problem with keep-with-next="always" and
>> keep-with-previous="always" properties
>>
>
> Hi,
>
>
>
>> The fop version that I’m dealing with is 0.20.5
>>
>
> Can't you upgrade to 0.95 where this bug probably doesn't exist? 0.20.5 was
> released in 2003. This is the reason no one replies to your post. No one
> remembers how this is very old version works anymore.
>
> Thanks,
>
> Chris
>
>
>
>>
>> The problem:
>>
>> Whenever table contains table header* and if a row contains data that does
>> not fit to a single page, and if this row is added to a keep-with-next list
>> or a keep-with-previous, the table get corrupted. Eg: the whole table get
>> printed in a single page overlapping the footer.
>>
>>
>> EG
>>
>>  _________________________________
>>
>> |   TABLE HEADER                  |
>>
>> |_________________________________|
>>
>> |row 1 - keep-with-next="always"  |
>>
>> |_________________________________|
>>
>> |row 2 - keep-with-next="always"  |
>>
>> |_________________________________|
>>
>> |row 3 - keep-with-next="always"  |
>>
>> |_________________________________|
>>
>> |row 4 - keep-with-next="always"  |
>>
>> |_________________________________|
>>
>>
>>
>> Seems that when this is the case. all rows are added to a single array
>> list and finally dropped to the page, and when one row contains a row which
>> is larger than the page (eg row 2). It creates a one single page overflowing
>> the page footer to the very end of the page.
>>
>>
>> And if we disconnect the keep with array. Eg remove keep-with-next from
>> the  row 1, all works as expected!
>>
>>
>> It seems that, if the first row of the table is joined with a keep-with
>> list and if this list contains larger than page row this error will come.
>> Seems to be that one row must be laid solidly on the page in order to
>> keep-with larger than page rows to be work.
>>
>> Did anyone else faced the same when using fop 0.20.5 ?
>>
>> Can someone point me where in fop code should I look for calculating and
>> splitting according to the remaining page height vs. largest cell height?
>>
>> (org.apache.fop.fo.flow. TableRow. Layout ?)
>>
>>
>> What I want to do is, check if the remaining height is not enough move to
>> the next page. Print as much as possible then *continue to the next. Whats
>> happening is it just move to the next page and dump all the content in the
>> next page.
>>
>>
>> Thanks in advance
>>
>> Asitha.
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

Re: Problem with keep-with-next="always" and keep-with-previous="always" fop 0.20.5

Posted by Chris Bowditch <bo...@hotmail.com>.
asitha w wrote:
>  
> 
> Hi every one, I’m facing a problem with keep-with-next="always" and 
> keep-with-previous="always" properties

Hi,

> 
> The fop version that I’m dealing with is 0.20.5

Can't you upgrade to 0.95 where this bug probably doesn't exist? 0.20.5 
was released in 2003. This is the reason no one replies to your post. No 
one remembers how this is very old version works anymore.

Thanks,

Chris

> 
>  
> 
> The problem:
> 
> Whenever table contains table header* and if a row contains data that 
> does not fit to a single page, and if this row is added to a 
> keep-with-next list or a keep-with-previous, the table get corrupted. 
> Eg: the whole table get printed in a single page overlapping the footer.
> 
>  
> 
> EG
> 
>  _________________________________
> 
> |   TABLE HEADER                  |
> 
> |_________________________________|
> 
> |row 1 - keep-with-next="always"  |
> 
> |_________________________________|
> 
> |row 2 - keep-with-next="always"  |
> 
> |_________________________________|
> 
> |row 3 - keep-with-next="always"  |
> 
> |_________________________________|
> 
> |row 4 - keep-with-next="always"  |
> 
> |_________________________________|
> 
>  
> 
>  
> 
> Seems that when this is the case. all rows are added to a single array 
> list and finally dropped to the page, and when one row contains a row 
> which is larger than the page (eg row 2). It creates a one single page 
> overflowing the page footer to the very end of the page.
> 
>  
> 
> And if we disconnect the keep with array. Eg remove keep-with-next from 
> the  row 1, all works as expected!
> 
>  
> 
> It seems that, if the first row of the table is joined with a keep-with 
> list and if this list contains larger than page row this error will 
> come. Seems to be that one row must be laid solidly on the page in order 
> to keep-with larger than page rows to be work.  
> 
>  
> 
> Did anyone else faced the same when using fop 0.20.5 ?
> 
> Can someone point me where in fop code should I look for calculating and 
> splitting according to the remaining page height vs. largest cell height?
> 
> (org.apache.fop.fo.flow. TableRow. Layout ?)
> 
>  
> 
> What I want to do is, check if the remaining height is not enough move 
> to the next page. Print as much as possible then *continue to the next. 
> Whats happening is it just move to the next page and dump all the 
> content in the next page.
> 
>  
> 
> Thanks in advance
> 
> Asitha.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org