com.itextpdf.text.pdf.parser
Class LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage

java.lang.Object
  extended by com.itextpdf.text.pdf.parser.LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage
All Implemented Interfaces:
Comparable<LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage>
Enclosing class:
LocationAwareTextExtractingPdfContentRenderListener

private static class LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage
extends Object
implements Comparable<LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage>

Represents a chunk of text, it's orientation, and location relative to the orientation vector


Field Summary
(package private)  int distParallel
          parallel distance to the orientation unit vector (i.e.
(package private)  int distPerpendicular
          perpendicular distance to the orientation unit vector (i.e.
(package private)  Vector endLocation
          the ending location of the chunk
(package private)  int orientationMagnitude
          the magnitude of the orientation - this consists of just the Y component of the orientation vector this seems to work for now, but we may need to move to a different mechanism once we run into PDFs with different text orientation (This is just not an area that's been tested yet)
(package private)  Vector orientationVector
          unit vector in the orientation of the chunk
(package private)  Vector startLocation
          the starting location of the chunk
(package private)  String text
          the text of the chunk
 
Constructor Summary
LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage(String string, Vector startLocation, Vector endLocation)
           
 
Method Summary
private static int compareInts(int int1, int int2)
           
 int compareTo(LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage rhs)
          Compares based on orientation, perpendicular distance, then parallel distance
private  void printDiagnostics()
           
 boolean sameLine(LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage as)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

text

final String text
the text of the chunk


startLocation

final Vector startLocation
the starting location of the chunk


endLocation

final Vector endLocation
the ending location of the chunk


orientationVector

final Vector orientationVector
unit vector in the orientation of the chunk


orientationMagnitude

final int orientationMagnitude
the magnitude of the orientation - this consists of just the Y component of the orientation vector this seems to work for now, but we may need to move to a different mechanism once we run into PDFs with different text orientation (This is just not an area that's been tested yet)


distPerpendicular

final int distPerpendicular
perpendicular distance to the orientation unit vector (i.e. the Y position in an unrotated coordinate system)


distParallel

final int distParallel
parallel distance to the orientation unit vector (i.e. the X position in an unrotated coordinate system

Constructor Detail

LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage

public LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage(String string,
                                                                          Vector startLocation,
                                                                          Vector endLocation)
Method Detail

printDiagnostics

private void printDiagnostics()

sameLine

public boolean sameLine(LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage as)
Parameters:
as - the location to compare to
Returns:
true is this location is on the the same line as the other

compareTo

public int compareTo(LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage rhs)
Compares based on orientation, perpendicular distance, then parallel distance

Specified by:
compareTo in interface Comparable<LocationAwareTextExtractingPdfContentRenderListener.LocationOnPage>
See Also:
Comparable.compareTo(java.lang.Object)

compareInts

private static int compareInts(int int1,
                               int int2)
Parameters:
int1 -
int2 -
Returns:
comparison of the two integers

Hosted by Hostbasket