Package com.itextpdf.text.pdf.parser
Class LocationTextExtractionStrategy.TextChunk
java.lang.Object
com.itextpdf.text.pdf.parser.LocationTextExtractionStrategy.TextChunk
- All Implemented Interfaces:
Comparable<LocationTextExtractionStrategy.TextChunk>
- Enclosing class:
- LocationTextExtractionStrategy
public static class LocationTextExtractionStrategy.TextChunk
extends Object
implements Comparable<LocationTextExtractionStrategy.TextChunk>
Represents a chunk of text, it's orientation, and location relative to the orientation vector
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LocationTextExtractionStrategy.TextChunkLocation
private final String
the text of the chunk -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compares based on orientation, perpendicular distance, then parallel distancefloat
Computes the distance between the end of 'other' and the beginning of this chunk in the direction of this chunk's orientation vector.float
getText()
private void
private boolean
sameLine
(LocationTextExtractionStrategy.TextChunk lastChunk)
-
Field Details
-
text
the text of the chunk -
location
-
-
Constructor Details
-
TextChunk
-
TextChunk
-
-
Method Details
-
getText
- Returns:
- the text captured by this chunk
-
getLocation
- Returns:
- an object holding location data about this TextChunk
-
getStartLocation
- Returns:
- the start location of the text
-
getEndLocation
- Returns:
- the end location of the text
-
getCharSpaceWidth
public float getCharSpaceWidth()- Returns:
- the width of a single space character as rendered by this chunk
-
distanceFromEndOf
Computes the distance between the end of 'other' and the beginning of this chunk in the direction of this chunk's orientation vector. Note that it's a bad idea to call this for chunks that aren't on the same line and orientation, but we don't explicitly check for that condition for performance reasons.- Parameters:
other
- the otherLocationTextExtractionStrategy.TextChunk
- Returns:
- the number of spaces between the end of 'other' and the beginning of this chunk
-
printDiagnostics
private void printDiagnostics() -
compareTo
Compares based on orientation, perpendicular distance, then parallel distance- Specified by:
compareTo
in interfaceComparable<LocationTextExtractionStrategy.TextChunk>
- Parameters:
rhs
- the other object- See Also:
-
sameLine
-