org.pdfbox.pdfviewer
Class PageDrawer

java.lang.Object
  extended byorg.pdfbox.util.PDFStreamEngine
      extended byorg.pdfbox.pdfviewer.PageDrawer

public class PageDrawer
extends PDFStreamEngine

This will paint a page in a PDF document to a graphics context.

Version:
$Revision: 1.19 $
Author:
Ben Litchfield

Constructor Summary
PageDrawer()
          Default constructor, loads properties from file.
 
Method Summary
 void drawPage(Graphics g, PDPage p, Dimension pageDimension)
          This will draw the page to the requested context.
 double fixY(double x, double y)
          Fix the y coordinate based on page rotation.
 Graphics2D getGraphics()
          Get the graphics that we are currently drawing on.
 GeneralPath getLinePath()
          Get the current line path to be drawn.
 List getLineSubPaths()
          Get the current list of line paths to be drawn.
 Color getNonStrokingColor()
          Get the non stroking color.
 PDPage getPage()
          Get the page that is currently being drawn.
 Dimension getPageSize()
          Get the size of the page that is currently being drawn.
 Color getStrokingColor()
          Get the stroking color.
 void setLinePath(GeneralPath newLinePath)
          Set the line path to draw.
 void setLineSubPaths(List newLineSubPaths)
          Set the list of line paths to draw.
 void setNonStrokingColor(Color newNonStrokingColor)
          Set the non stroking color.
 void setStrokingColor(Color newStrokingColor)
          Set the stroking color.
protected  void showCharacter(TextPosition text)
          You should override this method if you want to perform an action when a string is being shown.
 
Methods inherited from class org.pdfbox.util.PDFStreamEngine
getColorSpaces, getCurrentPage, getFonts, getGraphicsStack, getGraphicsState, getGraphicsStates, getResources, getTextLineMatrix, getTextMatrix, getXObjects, processOperator, processOperator, processStream, processSubStream, registerOperatorProcessor, resetEngine, setColorSpaces, setFonts, setGraphicsStack, setGraphicsState, setGraphicsStates, setTextLineMatrix, setTextMatrix, showString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageDrawer

public PageDrawer()
           throws IOException
Default constructor, loads properties from file.

Throws:
IOException - If there is an error loading properties from the file.
Method Detail

drawPage

public void drawPage(Graphics g,
                     PDPage p,
                     Dimension pageDimension)
              throws IOException
This will draw the page to the requested context.

Parameters:
g - The graphics context to draw onto.
p - The page to draw.
pageDimension - The size of the page to draw.
Throws:
IOException - If there is an IO error while drawing the page.

showCharacter

protected void showCharacter(TextPosition text)
You should override this method if you want to perform an action when a string is being shown.

Overrides:
showCharacter in class PDFStreamEngine
Parameters:
text - The string to display.

getGraphics

public Graphics2D getGraphics()
Get the graphics that we are currently drawing on.

Returns:
The graphics we are drawing on.

getPage

public PDPage getPage()
Get the page that is currently being drawn.

Returns:
The page that is being drawn.

getPageSize

public Dimension getPageSize()
Get the size of the page that is currently being drawn.

Returns:
The size of the page that is being drawn.

fixY

public double fixY(double x,
                   double y)
Fix the y coordinate based on page rotation.

Parameters:
x - The x coordinate.
y - The y coordinate.
Returns:
The updated y coordinate.

getLinePath

public GeneralPath getLinePath()
Get the current line path to be drawn.

Returns:
The current line path to be drawn.

setLinePath

public void setLinePath(GeneralPath newLinePath)
Set the line path to draw.

Parameters:
newLinePath - Set the line path to draw.

getLineSubPaths

public List getLineSubPaths()
Get the current list of line paths to be drawn.

Returns:
The current list of line paths to be drawn.

setLineSubPaths

public void setLineSubPaths(List newLineSubPaths)
Set the list of line paths to draw.

Parameters:
newLineSubPaths - Set the list of line paths to draw.

getNonStrokingColor

public Color getNonStrokingColor()
Get the non stroking color.

Returns:
The non stroking color.

setNonStrokingColor

public void setNonStrokingColor(Color newNonStrokingColor)
Set the non stroking color.

Parameters:
newNonStrokingColor - The non stroking color.

getStrokingColor

public Color getStrokingColor()
Get the stroking color.

Returns:
The stroking color.

setStrokingColor

public void setStrokingColor(Color newStrokingColor)
Set the stroking color.

Parameters:
newStrokingColor - The stroking color.