> On 7 Sep 2016, at 08:02, Markus Barbey <[email protected]> wrote: > > Hello there, > > when using > > PDFRender#renderPageToGraphics(int, Graphics2D) > > you can set an AffineTransform (e.G. scale and translate) in the Graphics2D > instance which results in a partially rendered PDF page. Nevertheless each > resource gets rendered by the renderer - even if it is not visible in the > resulting BufferedImage. > > For example: PDF original size 800x600 > > -------------------------------------------- > > BufferedImage image = new BufferedImage (400, 200, > BufferedImage.TYPE_INT_RGB); > Graphics2D graphics = image.createGraphics (); > > AffineTransform tx = new AffineTransform (); > tx.translate (200,300); > tx.scale (2, 2); > graphics.setTransform (tx); > > renderer.renderPageToGraphics (0, graphics); > graphics.dispose (); > > -------------------------------------------- > > When you have some large images (e.G. high DPI logo and charts) on a single > PDF page there could be a great performance boost for partial rendering (that > is mainly required in PDF viewer controls), if images, that are not going to > be visible in the resulting BufferedImage skipped while drawing. Nowadays > they are converted to a BufferedImage (which can last remarkable time) and > drawn to the Graphics2D. Due to size and clipping configuration they are not > visible in the resulting BufferedImage.
I would recommend caching the BufferedImage for an entire rendered page instead and then having your PDF viewer display a portion of that image. — John > > > Cu > Markus > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

