g.translate(-leftMBP, -topMBP); g.translate(0, page.getTop());
g.translate(0, page.getPaintingTop());  g.setClip(working); page.paintAlternateFlows(c, root, 0);  page.paintBorder(c, 0);
    public void paintPage(Graphics2D g, int pageNo) {        Layer root = getRootLayer();        if (root == null) {            throw new RuntimeException("Document needs layout");        }                if (pageNo < 1 || pageNo > root.getPages().size()) {            throw new IllegalArgumentException("Page " + pageNo + " is not between 1 " +                    "and " + root.getPages().size());        }        RenderingContext c = newRenderingContext(g);        PageBox page = (PageBox)root.getPages().get(pageNo-1);                Shape working = g.getClip();                int leftMBP = page.getStyle().getMarginBorderPadding(c, CalculatedStyle.LEFT);        int topMBP = page.getStyle().getMarginBorderPadding(c, CalculatedStyle.TOP);        g.translate(0, -page.getTop());        g.translate(leftMBP, topMBP);        g.clipRect(0, page.getTop(), page.getContentWidth(c), page.getContentHeight(c));        root.paint(c, 0, 0);        g.translate(-leftMBP, -topMBP);        g.translate(0, page.getTop());        g.setClip(working);    }