Am 07.09.2016 um 17:02 schrieb Markus Barbey:
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.
Feel free to make a patch for PageDrawer.drawImage that checks whether
the image will be outside... Be aware that both images and the xform can
be rotated.
Tilman
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]