at.knowcenter.wag.egov.egiz.pdf
Class PDFPage

java.lang.Object
  extended by org.pdfbox.util.PDFStreamEngine
      extended by org.pdfbox.util.PDFTextStripper
          extended by at.knowcenter.wag.egov.egiz.pdf.PDFPage

public class PDFPage
extends PDFTextStripper

PDFPage is an inner class that is used to calculate the page length of a PDF Document page. It extends the PDFTextStripper class and implement one interested method: showCharacter(TextPosition)
This method is called when processing the FileStream. By calling the method PDFStreamEngine.processStream(org.pdfbox.pdmodel.PDPage, org.pdfbox.pdmodel.PDResources, org.pdfbox.cos.COSStream) the implemented method showCharacter is called.

Author:
wlackner
See Also:
PDFTextStripper

Nested Class Summary
 class PDFPage.MyInvoke
           
 
Nested classes/interfaces inherited from class org.pdfbox.util.PDFStreamEngine
PDFStreamEngine.StreamResources
 
Field Summary
protected  float footer_line
          The y coordinate of the footer line.
protected  float max_character_ypos
          The maximum (lowest) y position of a character.
protected  float max_image_ypos
          The maximum (lowest y position of an image.
 
Fields inherited from class org.pdfbox.util.PDFTextStripper
charactersByArticle, output
 
Fields inherited from class org.pdfbox.util.PDFStreamEngine
fontToAverageWidths, graphicsStack, operators, page, SPACE_BYTES, streamResourcesStack, textLineMatrix, textMatrix
 
Constructor Summary
PDFPage(float footer_line)
          Constructor.
 
Method Summary
static float findMaxX(Pos[] coordinates)
           
static float findMinX(Pos[] coordinates)
           
static float findMinY(Pos[] coordinates)
           
 float getMaxPageLength()
          Returns the calculated page length.
protected  void processOperator(PDFOperator operator, List arguments)
          This is used to handle an operation.
protected  void showCharacter(TextPosition text)
          A method provided as an event interface to allow a subclass to perform some specific functionality when a character needs to be displayed.
static Pos transtormCoordinate(Pos pos, Matrix m)
           
static Pos[] transtormCoordinates(Pos[] coordinates, Matrix m)
           
 
Methods inherited from class org.pdfbox.util.PDFTextStripper
endDocument, endPage, endParagraph, flushText, getCharactersByArticle, getCurrentPageNo, getEndBookmark, getEndPage, getLineSeparator, getOutput, getPageSeparator, getStartBookmark, getStartPage, getText, getText, getWordSeparator, processPage, processPages, setEndBookmark, setEndPage, setLineSeparator, setPageSeparator, setShouldSeparateByBeads, setSortByPosition, setStartBookmark, setStartPage, setSuppressDuplicateOverlappingText, setWordSeparator, shouldSeparateByBeads, shouldSortByPosition, shouldSuppressDuplicateOverlappingText, startDocument, startPage, startParagraph, writeCharacters, writeText, writeText
 
Methods inherited from class org.pdfbox.util.PDFStreamEngine
getColorSpaces, getCurrentPage, getFonts, getGraphicsStack, getGraphicsState, getGraphicsStates, getResources, getTextLineMatrix, getTextMatrix, getXObjects, processOperator, processStream, processSubStream, 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
 

Field Detail

max_character_ypos

protected float max_character_ypos
The maximum (lowest) y position of a character.


max_image_ypos

protected float max_image_ypos
The maximum (lowest y position of an image.


footer_line

protected float footer_line
The y coordinate of the footer line. PDF elements below this footer line will not be regarded.

Constructor Detail

PDFPage

public PDFPage(float footer_line)
        throws IOException
Constructor.

Parameters:
footer_line - The y coordinate of the footer line. PDF elements below this footer line will not be regarded.
Throws:
IOException
Method Detail

processOperator

protected void processOperator(PDFOperator operator,
                               List arguments)
                        throws IOException
Description copied from class: PDFStreamEngine
This is used to handle an operation.

Overrides:
processOperator in class PDFStreamEngine
Parameters:
operator - The operation to perform.
arguments - The list of arguments.
Throws:
IOException - If there is an error processing the operation.

showCharacter

protected void showCharacter(TextPosition text)
A method provided as an event interface to allow a subclass to perform some specific functionality when a character needs to be displayed. This method is used to calculate the latest position of a text in the page. Sorry for this missinterpretation of the method, but it is the only way to do this (provided by PDFBox)!!!

Overrides:
showCharacter in class PDFTextStripper
Parameters:
text - the character to be displayed -> calculate there y position.

getMaxPageLength

public float getMaxPageLength()
Returns the calculated page length.

Returns:
the max page length value

transtormCoordinates

public static Pos[] transtormCoordinates(Pos[] coordinates,
                                         Matrix m)

transtormCoordinate

public static Pos transtormCoordinate(Pos pos,
                                      Matrix m)

findMinY

public static float findMinY(Pos[] coordinates)

findMaxX

public static float findMaxX(Pos[] coordinates)

findMinX

public static float findMinX(Pos[] coordinates)


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.