page.paintAlternateFlows(c, root, 0);
page.paintAlternateFlows(c, root, Layer.PAGED_MODE_PRINT, 0);
    public void paintPage(Graphics2D g, int pageNo) {        Layer root = getRootLayer();        if (root == null) {            throw new RuntimeException("Document needs layout");        }                if (pageNo < 0 || pageNo >= root.getPages().size()) {            throw new IllegalArgumentException("Page " + pageNo + " is not between 0 " +                    "and " + root.getPages().size());        }        RenderingContext c = newRenderingContext(g);        PageBox page = (PageBox)root.getPages().get(pageNo);                Shape working = g.getClip();                Rectangle content = page.getPrintingClippingBounds(c);        g.clip(content);                g.translate(0, -page.getPaintingTop());        root.paint(c, 0, 0);        g.translate(0, page.getPaintingTop());                g.setClip(working);        page.paintAlternateFlows(c, root, 0);                page.paintBorder(c, 0);        g.setClip(working);    }