Aspose::Pdf::Text::TextSegment class
TextSegment class
Represents segment of Pdf text.
class TextSegment : public System::Object
Methods
Method | Description |
---|---|
get_BaselinePosition() const | Gets text position for text, represented with TextSegment object. The YIndent of the Position structure represents baseline coordinate of the text segment. |
get_Characters() | Gets collection of CharInfo objects that represent information on characters in the text segment. |
get_EndCharIndex() const | Gets ending character index of current segment in the show text operator (Tj, TJ) segment. |
get_Hyperlink() const | Gets the segment hyperlink(for pdf generator). |
get_Position() const | Gets text position for text, represented with TextSegment object. |
get_Rectangle() | Gets rectangle of the TextSegment. |
get_StartCharIndex() const | Gets starting character index of current segment in the show text operator (Tj, TJ) segment. |
get_Text() const | Gets System::String text object that the TextSegment object represents. |
get_TextEditOptions() const | Gets text edit options. The options define special behavior when requested symbol cannot be written with font. |
get_TextState() const | Gets text state for the text that TextSegment object represents. |
static MyHtmlEncode(System::String) | Encodes string as html. |
set_BaselinePosition(System::SharedPtr<Aspose::Pdf::Text::Position>) | Gets text position for text, represented with TextSegment object. The YIndent of the Position structure represents baseline coordinate of the text segment. |
set_Hyperlink(System::SharedPtr<Aspose::Pdf::Hyperlink>) | Sets the segment hyperlink(for pdf generator). |
set_Position(System::SharedPtr<Aspose::Pdf::Text::Position>) | Gets text position for text, represented with TextSegment object. |
set_Text(System::String) | Sets System::String text object that the TextSegment object represents. |
set_TextEditOptions(System::SharedPtr<Aspose::Pdf::Text::TextEditOptions>) | Sets text edit options. The options define special behavior when requested symbol cannot be written with font. |
set_TextState(System::SharedPtr<Aspose::Pdf::Text::TextState>) | Sets text state for the text that TextSegment object represents. |
TextSegment() | Creates TextSegment object. |
TextSegment(System::String) | Creates TextSegment object. |
Remarks
In a few words, TextSegment objects are children of TextFragment object.
In details:
Text of pdf document in Aspose::Pdf is represented by two basic objects: TextFragment and TextSegment
The differences between them is mostly context-dependent.
Let’s consider following scenario. User searches text “hello world” to operate with it, change it’s properties, look etc.
Document doc = new Document(docFile);
TextFragmentAbsorber absorber = new TextFragmentAbsorber("hello world");
doc.Pages[1].Accept(absorber);
Phisycally pdf text’s representation is very complex. The text “hello world” may consist of several phisycally independent text segments.
The Aspose.Pdf text model basically establishes that TextFragment object provides single logic operation set over physical TextSegment objects set that represent user’s query.
In text search scenario, TextFragment is logical “hello world” text representation, and TextSegment object collection represents all physical segments that construct “hello world” text object.
So, TextFragment is close to logical text representation. And TextSegment is close to physical text representation.
Obviously each TextSegment object may have it’s own font, coloring, positioning properties.
TextFragment provides simple way to change text with it’s properties: set font, set font size, set font color etc. Meanwhile TextSegment objects are accessible and users are able to operate with TextSegment objects independently.
See Also
- Class Object
- Namespace Aspose::Pdf::Text
- Library Aspose.PDF for C++