After all, I've now a working version including before and after regions for 0.92beta.

Changes are minimal:

Return Integer.MAX_VALUE  in EnumLength.getValue:

    public int getValue() {
        if (enumProperty.getEnum() == Constants.EN_INDEFINITE)
            return Integer.MAX_VALUE;
        log.error("getValue() called on " + enumProperty + " length");
        return 0;

Insert at the beginning of PageSequenceLayoutManager.finishPage() adding appropriate missing imports (e.g. let Eclipse do it):

if (curPage.getSimplePageMaster().getPageHeight().getEnum() == Constants.EN_INDEFINITE) {

            // start with current y position
            BodyRegion br = curPage.getPageViewport().getBodyRegion();
float height = (float) br.getRegionViewport().getViewArea ().getY();

            // add actual height of body region
            List spanList = br.getMainReference().getSpans();
            if (spanList != null) {
                ListIterator spanListIter = spanList.listIterator();
                while (spanListIter.hasNext()) {
                        Span span = (Span);
                        height += span.getHeight();
height += br.getBorderAndPaddingWidthAfter() + br.getSpaceAfter();

            // honor and reposition after region
RegionReference after = curPage.getPageViewport ().getRegionReference(FO_REGION_AFTER);
            if (after != null) {
Rectangle2D afterRect = after.getRegionViewport ().getViewArea(); after.setCTM(after.getCTM().translate(0, height - afterRect.getY()));
                height += afterRect.getHeight();

            // update page viewport size
            Rectangle2D rect = curPage.getPageViewport().getViewArea();
rect.setRect(rect.getX(), rect.getY(), rect.getWidth(), height);

I haven't thought about reference orientation issues yet, but maybe useful to somebody already.

Walter Bauer

Reply via email to