TextFragment

Overview

TextFragment is a class in Aspose.PDF FOSS for .NET. Inherits from: BaseParagraph.

Represents a fragment of text on a page with position and style information.

This class provides 8 methods for working with TextFragment objects in .NET programs. Available methods include: Clone, CloneWithSegments, IsolateTextSegments, TextFragment. All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package. Properties: BaselinePosition, EndNote, FontSize, FootNote, Form, HorizontalAlignment, and 20 more.

Properties

NameTypeAccessDescription
TabStopsTabStops?Read/WriteTab stops for this fragment (used with #$TAB markers in text).
TextEditOptionsTextEditOptionsRead/WriteEdit options applied during text replacement / font substitution.
IsInLineParagraphboolRead/WriteWhen true, this text fragment renders on the same line as the previous in-line paragraph (see docs.aspose.com/pdf/net/add-text-to-pdf-file “inline paragraphs”).
IsInNewPageboolRead/WriteGets or sets the is in new page.
VerticalAlignmentVerticalAlignmentRead/WriteGets or sets the vertical alignment.
TextstringRead/WriteThe text content.
ReplaceOptionsTextReplaceOptionsReadText-replacement options used by TextFragmentAbsorber replace paths.
PagePage?ReadThe page this fragment belongs to (public alias for SourcePage).
FormXForm?ReadThe XForm this fragment was extracted from, or null for page-level fragments.
FootNoteNote?Read/WriteOptional footnote attached to this fragment.
HorizontalAlignmentHorizontalAlignmentRead/WriteHorizontal alignment used when this fragment is laid out as a paragraph (added to page.Paragraphs).
RectangleRectangle?ReadThe bounding rectangle of this text fragment on the page.
PositionPosition?Read/WriteThe text position.
BaselinePositionPosition?Read/WriteThe text baseline position.
MarginMarginInfoRead/WriteMargin information for layout when used as a paragraph element.
TextStateTextFragmentStateReadText state (font, size, color).
PageIndexintReadThe page index (0-based) this fragment was found on.
FontSizedoubleReadShortcut for TextState.FontSize.
SegmentsTextSegmentCollectionRead/WriteThe collection of text segments that make up this fragment (1-indexed).
HyperlinkHyperlinkRead/WriteHyperlink applied to this fragment.
EndNoteNote?Read/WriteEndnote attached to this fragment.
WrapLinesCountintRead/WriteNumber of wrapped lines computed during layout.
IsFirstParagraphInColumnboolRead/WriteForce the paragraph to start a new column.
IsKeptWithNextboolRead/WriteKeep this paragraph on the same page as the next one.
HyperlinkTextstring?Read/WriteLegacy string-typed hyperlink target.
ZIndexintRead/WriteZ-order index used by the DOM renderer.

Methods

SignatureDescription
TextFragment()Create a text fragment with tab stops.
TextFragment(tabStops: TabStops)Calls TextFragment on this TextFragment instance.
TextFragment(text: string)Create a text fragment with the given text.
TextFragment(text: string, tabStops: TabStops)Create a text fragment with the given text and tabStops resolution table.
TextFragment(text: string, rectangle: Rectangle?, textState: TextState?)
IsolateTextSegments(startIndex: int, length: int)Return text segments covering the given character range (startIndex is 1-based).
Clone()Shallow copy of the fragment (text + state).
CloneWithSegments()Clone the fragment AND its segments.

See Also