public final class CharInfoCollection extends Object implements Iterable<CharInfo>
Represents CharInfo objects collection.
The example demonstrates how to iterate thought all the characters and retrieve the character //open document Document pdfDocument = new Document(inFile); //create TextFragmentAbsorber object to collect all the text objects of the page TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(); //accept the absorber for all the pages pdfDocument.getPages().get_Item(1).accept(textFragmentAbsorber); //get the extracted text fragments TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments(); //loop through the fragments for (TextFragment textFragment : (Iterable<TextFragment>
)textFragmentCollection) { //loop through the segments for (TextSegment textSegment : (Iterable<TextSegment>
) textFragment.getSegments()) { //loop through the charactersfor (int i = 1; i <= textSegment.getText().length(); i++)
{ CharInfo charInfo = textSegment.getCharacters().get_Item(i); // print character position and rectangle info System.out.println("XIndent : " + charInfo.getPosition().getXIndent()); System.out.println("YIndent : " + charInfo.getPosition().getYIndent()); System.out.println("Width : " + charInfo.getRectangle().getWidth()); System.out.println("Height : " + charInfo.getRectangle().getHeight()); } } }
Provides access to positioning information of text segment characters.
Modifier and Type | Method and Description |
---|---|
void |
add(CharInfo item)
Not supported yet.
|
void |
clear()
Not supported yet.
|
boolean |
contains(CharInfo item)
Determines whether the collection contains a specific value.
|
void |
copyTo(CharInfo[] array,
int index)
Copies the entire collection to a compatible one-dimensional Array, starting at the specified
index of the target array
|
CharInfo |
get_Item(int index)
Gets the CharInfo element at the specified index 1..n.
|
Object |
getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
|
boolean |
isReadOnly()
Gets a value indicating whether collection is read-only
|
boolean |
isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
|
com.aspose.ms.System.Collections.IEnumerator |
iterator_Rename_Namesake()
Returns an enumerator for the entire collection.
|
com.aspose.ms.System.Collections.IEnumerator<CharInfo> |
iterator()
Returns an enumerator for the entire collection.
|
boolean |
remove(CharInfo item)
Not supported yet.
|
int |
size()
Gets the number of
CharInfo object elements actually contained in the collection. |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public int size()
Gets the number of CharInfo
object elements actually contained in the collection.
public Object getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
public boolean isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
public boolean isReadOnly()
Gets a value indicating whether collection is read-only
public com.aspose.ms.System.Collections.IEnumerator iterator_Rename_Namesake()
Returns an enumerator for the entire collection.
public com.aspose.ms.System.Collections.IEnumerator<CharInfo> iterator()
Returns an enumerator for the entire collection.
public void copyTo(CharInfo[] array, int index)
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array
array
- Array of objects which will be copied.index
- Starting index from which copying will be started.public void add(CharInfo item)
Collection is read-only. Always throws NotImplementedException.
item
- CharInfo instancepublic void clear()
Collection is read-only. Always throws NotImplementedException.
public boolean contains(CharInfo item)
Determines whether the collection contains a specific value.
item
- The object to locate in the collectionpublic boolean remove(CharInfo item)
Collection is read-only. Always throws NotImplementedException.
item
- CharInfo instancepublic CharInfo get_Item(int index)
Gets the CharInfo element at the specified index 1..n.
index
- Index within the collection.