public class LocationTextExtractionStrategy extends Object implements ITextExtractionStrategy
Modifier and Type | Class and Description |
---|---|
static interface |
LocationTextExtractionStrategy.ITextChunkLocation |
static interface |
LocationTextExtractionStrategy.ITextChunkLocationStrategy |
static class |
LocationTextExtractionStrategy.TextChunk
Represents a chunk of text, it's orientation, and location relative to the orientation vector
|
static class |
LocationTextExtractionStrategy.TextChunkLocationDefaultImp |
Constructor and Description |
---|
LocationTextExtractionStrategy()
Creates a new text extraction renderer.
|
LocationTextExtractionStrategy(LocationTextExtractionStrategy.ITextChunkLocationStrategy strat)
Creates a new text extraction renderer, with a custom strategy for creating new TextChunkLocation objects based on the input of the TextRenderInfo.
|
Modifier and Type | Method and Description |
---|---|
void |
eventOccurred(IEventData data, EventType type)
Called when some event occurs during parsing a content stream.
|
String |
getResultantText()
Returns the text that has been processed so far.
|
Set<EventType> |
getSupportedEvents()
Provides the set of event types this listener supports.
|
protected boolean |
isChunkAtWordBoundary(LocationTextExtractionStrategy.TextChunk chunk, LocationTextExtractionStrategy.TextChunk previousChunk)
Determines if a space character should be inserted between a previous chunk and the current chunk.
|
boolean |
isUseActualText()
Gets the value of the property which determines if /ActualText will be used when extracting the text
|
LocationTextExtractionStrategy |
setRightToLeftRunDirection(boolean rightToLeftRunDirection)
Sets if text flows from left to right or from right to left.
|
LocationTextExtractionStrategy |
setUseActualText(boolean useActualText)
Changes the behavior of text extraction so that if the parameter is set to true , /ActualText marked content property will be used instead of raw decoded bytes.
|
public LocationTextExtractionStrategy()
public LocationTextExtractionStrategy(LocationTextExtractionStrategy.ITextChunkLocationStrategy strat)
strat
- the custom strategy
public LocationTextExtractionStrategy setUseActualText(boolean useActualText)
true
, /ActualText marked content property will be used instead of raw decoded bytes. Beware: the logic is not stable yet.
useActualText
- true to use /ActualText, false otherwise
public LocationTextExtractionStrategy setRightToLeftRunDirection(boolean rightToLeftRunDirection)
true
argument for extracting Arabic, Hebrew or other text with right-to-left writing direction.
rightToLeftRunDirection
- value specifying whether the direction should be right to left
public boolean isUseActualText()
public void eventOccurred(IEventData data, EventType type)
IEventListener
eventOccurred
in interface IEventListener
data
- Combines the data required for processing corresponding event type.
type
- Event type.
public Set<EventType> getSupportedEvents()
IEventListener
getSupportedEvents
in interface IEventListener
public String getResultantText()
ITextExtractionStrategy
getResultantText
in interface ITextExtractionStrategy
String
instance with the current resultant text
protected boolean isChunkAtWordBoundary(LocationTextExtractionStrategy.TextChunk chunk, LocationTextExtractionStrategy.TextChunk previousChunk)
chunk
- the new chunk being evaluated
previousChunk
- the chunk that appeared immediately before the current chunk
Copyright © 1998–2017 iText Group NV. All rights reserved.