g2r.getPanel().assignPagePaintingPositions(g2, 0);
g2r.getPanel().assignPagePrintPositions(g2);
    public int print(Graphics g, PageFormat pf, int page) {        try {            Graphics2D g2 = (Graphics2D) g;                        if (g2r == null) {                g2r = new Graphics2DRenderer();                g2r.getSharedContext().setPrint(true);                g2r.getSharedContext().setInteractive(false);                g2r.getSharedContext().setDPI(72f);                g2r.getSharedContext().getTextRenderer().setSmoothingThreshold(0);                g2r.getSharedContext().getTextRenderer().setSmoothingLevel(TextRenderer.HIGH);                g2r.setDocument(panel.getSharedContext().getUac().getBaseURL());                g2r.layout(g2, null);                g2r.getPanel().assignPagePaintingPositions(g2, 0);            }                        if (page >= g2r.getPanel().getRootLayer().getPages().size()) {                return Printable.NO_SUCH_PAGE;            }                        // render the document            g2r.getPanel().paintPage(g2, page);                        return Printable.PAGE_EXISTS;        } catch (Exception ex) {            Uu.p(ex);            return Printable.NO_SUCH_PAGE;        }    }