Andreas, Matthias,
I've digged a little more into the code and would like to share what
I've done and tested and so far.
I've added at the end of
PageSequenceLayoutManager.PageBreaker.finishPart:
if (getCurrentPage().getSimplePageMaster().getPageHeight().getEnum()
== Constants.EN_INDEFINITE) {
Rectangle2D rect = getCurrentPV().getViewArea();
getCurrentPV().getViewArea().setRect(rect.getX(), rect.getY(),
rect.getWidth(), rect.getHeight() - pbp.difference);
}
After some experiments to set the height/width in the Constructor of
PageViewport, I think it's better to defer it and resolve it in
EnumLength.getValue:
public int getValue() {
if (enumProperty.getEnum() == Constants.EN_INDEFINITE)
Integer.MAX_VALUE;
else
return 0;
}
getValue is called in RegionBody.getViewportRectangle for example and
changing getValue covers these calls as well.
Problems:
Actually it doesn't work that way. Returning Integer.MAX_VALUE in
EnumLength.getValue fails, resulting in a ridiculous long PDF page.
The length is off by 10000000. Returning some "huge" number instead
like 10000000 but not Integer.MAX_VALUE works however. Don't know
why, but I suspect that there is some Integer overflow somewhere.
I'm not sure if PageSequenceLayoutManager.PageBreaker.finishPart is
the right place to change the page size so tried a different approach
leaving PageSequenceLayoutManager.PageBreaker.finishPart unchanged.
Putting this code into PageSequenceLayoutManager.finishPage:
if (curPage.getSimplePageMaster().getPageHeight().getEnum() ==
Constants.EN_INDEFINITE) {
int height = (int) curPage.getPageViewport().getBodyRegion
().getRegionViewport().getViewArea().getY();
List spanList = curPage.getPageViewport().getBodyRegion
().getMainReference().getSpans();
ListIterator spanListIter = spanList.listIterator();
while (spanListIter.hasNext()) {
Span span = (Span) spanListIter.next();
height += span.getHeight();
}
Rectangle2D rect = curPage.getPageViewport().getViewArea();
curPage.getPageViewport().getViewArea().setRect(rect.getX(),
rect.getY(), rect.getWidth(), height);
}
works neatly, even with Integer.MAX_VALUE. However I don't like this
"manual" height recalculation too much.
Additional to dos / questions:
fo:region-body margin-bottom="1in" doesn't work yet
The after region has to be adjusted, otherwise it doesn't appear. How
to do that?
Support of page-width="indefinite"
Best regards,
Walter