public final class CharInfoCollection extends Object implements com.aspose.ms.System.Collections.ICollection
Represents CharInfo objects collection.
The example demonstrates how to iterate throught all the characters and retrieve the charact//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)textFragmentCollection) { //loop through the segments for (TextSegment textSegment : (Iterable ) textFragment.getSegments()) { //loop through the characters for (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()); } } }
Modifier and Type | Method and Description |
---|---|
void |
copyTo(com.aspose.ms.System.Array 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.
|
Object |
getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
|
boolean |
isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
|
com.aspose.ms.System.Collections.IEnumerator |
iterator()
Returns an enumerator for the entire collection.
|
int |
size()
Gets the number of
CharInfo object elements actually contained in the collection. |
public int size()
Gets the number of CharInfo
object elements actually contained in the collection.
size
in interface com.aspose.ms.System.Collections.ICollection
public Object getSyncRoot()
Gets an object that can be used to synchronize access to the collection.
getSyncRoot
in interface com.aspose.ms.System.Collections.ICollection
public boolean isSynchronized()
Gets a value indicating whether access to the collection is synchronized (thread safe).
isSynchronized
in interface com.aspose.ms.System.Collections.ICollection
public com.aspose.ms.System.Collections.IEnumerator iterator()
Returns an enumerator for the entire collection.
public void copyTo(com.aspose.ms.System.Array array, int index)
Copies the entire collection to a compatible one-dimensional Array, starting at the specified index of the target array
copyTo
in interface com.aspose.ms.System.Collections.ICollection
public CharInfo get_Item(int index)
Gets the CharInfo element at the specified index.
index
- Copyright © 2017 Aspose. All Rights Reserved.