|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.jadice.document.render.AbstractPageRenderer com.levigo.jadice.document.render.PageImageRenderer
public class PageImageRenderer
PageImageRenderer
provides an easy possibility to obtain a
buffered image which displays a defined area of a page or an entire
Page
.
To render a page into an image, just instantiate this class with a valid page
instance and optionally with a render control which should be applied in the
render process. Afterwards just call the renderImage()
method, which
returns the desired page representing image.
Field Summary | |
---|---|
protected static Logger |
LOGGER
|
Constructor Summary | |
---|---|
PageImageRenderer()
Creates an instance of this class. |
|
PageImageRenderer(Page page)
Creates an instance of this class. |
|
PageImageRenderer(Page page,
RenderControls renderControl)
Creates an instance of this class. |
Method Summary | |
---|---|
Rectangle |
getRenderArea()
Returns the page area, which will be used as clip bounds of the rendered image . |
boolean |
isEnableCaching()
|
protected void |
render(Graphics2D target)
Paint a Page . |
BufferedImage |
renderImage()
Creates and returns a buffered image instance representing the entire page content or defined area of the current page. |
void |
setEnableCaching(boolean enableCaching)
|
void |
setRenderArea(Rectangle area)
Sets the page area, which will be used as clip bounds of the rendered image . |
Methods inherited from class com.levigo.jadice.document.render.AbstractPageRenderer |
---|
getPage, getRenderControls, setPage, setRenderControls |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger LOGGER
Constructor Detail |
---|
public PageImageRenderer(Page page, RenderControls renderControl)
page
- The page to be rendered into the buffered image.renderControl
- The render control to be applied when rendering the page into a
buffered image. If the render control is NULL
, a
default render control with zoom 100%, rotation 0 and
deviceResolution 72dpi will be assumed.AbstractPageRenderer.setPage(Page)
,
AbstractPageRenderer.setRenderControls(RenderControls)
public PageImageRenderer(Page page)
page
- The page to be rendered into the buffered image.AbstractPageRenderer.setPage(Page)
,
AbstractPageRenderer.setRenderControls(RenderControls)
public PageImageRenderer()
Ensure to set a valid page instance and optionally a render control before
calling the renderImage()
method. Otherwise the
renderImage()
method will throw an adequate exception and the page
image renderer could not be used.
AbstractPageRenderer.setPage(Page)
,
AbstractPageRenderer.setRenderControls(RenderControls)
Method Detail |
---|
public Rectangle getRenderArea()
rendered image
.
The render area can be defined with a call of setRenderArea(Rectangle)
. If no render
area is defined the entire page bounds will be used. The entire page bounds are defined as
follows:
Dimension size = Pages.getRenderedSize(getPage(), getRenderControls());
Rectangle renderArea = new Rectangle(0,0,size.width, size.height);
public void setRenderArea(Rectangle area)
rendered image
.
The render area can be accessed with a call of getRenderArea()
. If
no render area is defined by a call of this method the entire page bounds
will be used. The entire page bounds are defined as follows:
Dimension size = Pages.getRenderedSize(getPage(), getRenderControls());
Rectangle renderArea = new Rectangle(0,0,size.width, size.height);
The given render area should be in device coordinates and must be entirely contained within the page bounds.
area
- the render area used within renderImage()
or null
if the entire page bounds should be used
IllegalArgumentException
- if the given area is not entirely contained in the page bounds
IllegalStateException
- if no page is availablepublic BufferedImage renderImage()
NULL
an
IllegalStateException
will be thrown.
IllegalStateException
- if page reference is null
AbstractPageRenderer.getPage()
,
AbstractPageRenderer.getRenderControls()
,
getRenderArea()
protected void render(Graphics2D target) throws JadiceException
AbstractPageRenderer
Page
. This method will paint the Page
set using AbstractPageRenderer.setPage(Page)
or if the Page
is null, return immediately.
render
in class AbstractPageRenderer
target
- the Graphics2D
to paint to.
JadiceException
- will be thrown if the initialization or the rendering of the
Page
failed.public boolean isEnableCaching()
public void setEnableCaching(boolean enableCaching)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |