*                       rendering hints settings.
     * @param pageBoundary   Constant specifying the page boundary to use when
     *                       painting the page content.
     * @param userRotation   Rotation factor, in degrees, to be applied to the rendered page.
     * @param userZoom       Zoom factor to be applied to the rendered page.
     */
    public void paintPage(int pageNumber, Graphics g, final int renderHintType,
                          final int pageBoundary, float userRotation, float userZoom) {
        Page page = catalog.getPageTree().getPage(pageNumber, this);
        PDimension sz = page.getSize(userRotation, userZoom);
        int pageWidth = (int) sz.getWidth();
        int pageHeight = (int) sz.getHeight();

        Graphics gg = g.create(0, 0, pageWidth, pageHeight);
        page.paint(gg, renderHintType, pageBoundary, userRotation, userZoom);

        gg.dispose();
        catalog.getPageTree().releasePage(page, this);
    }