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);
c.setPageCount(root.getPages().size());
c.setPage(pageNo, page);
page.paintBackground(c, 0, Layer.PAGED_MODE_PRINT);
page.paintMarginAreas(c, 0, Layer.PAGED_MODE_PRINT);
page.paintBorder(c, 0, Layer.PAGED_MODE_PRINT);