root.paint(c);
root.paint(c, 0, 0);
    public void paintPage(Graphics2D g, int page) {        Layer root = getRootLayer();        if (root == null) {            throw new RuntimeException("Document needs layout");        }        RenderingContext c = newRenderingContext(getPageInfo(), (Graphics2D) g);        PageInfo info = c.getPageInfo();        Border margins = info.getMargins();        Shape working = g.getClip();        g.translate(0, -(info.getContentHeight()) * (page - 1));        g.translate(margins.left, margins.top);        g.clipRect(0, (int) (info.getContentHeight() * (page - 1)), (int) info.getContentWidth(), (int) info.getContentHeight());        root.paint(c);        g.translate(-margins.left, -margins.top);        g.translate(0, info.getContentHeight() * (page - 1));        g.setClip(working);    }