Skip to content

PDFTextRun

Namespace: O2S.Components.PDF4NET.Content

Defines a fragment of text displayed on a PDF page.

public sealed class PDFTextRun

Inheritance ObjectPDFTextRun

Remarks

A text fragment is defined by a single 'show text' PDF operator. All the glyphs in a text fragment share the same graphic attributes.

Properties

Brush

Gets the brush used for filling the text interior.

public PDFBrush Brush { get; internal set; }

Property Value

PDFBrush
The brush used to fill the text interior.


Corners

Gets the coordinates of the text fragment corners.

public PDFPoint[] Corners { get; internal set; }

Property Value

PDFPoint[]
The coordinates on the page of the text fragment's corners.

Remarks

The order of the corners in the array is the following: lower left, lower right, upper right, upper left. These corners match the text baseline for the lower corners. The PDFTextRun.TypographicCorners property considers the font's Descent for the lower corners.


DisplayBounds

Gets the bounds of the text fragment.

public PDFDisplayRectangle DisplayBounds { get; }

Property Value

PDFDisplayRectangle
The bounding rectangle of the text fragment in visual coordinates.

Remarks

These bounds are based on the PDFTextRun.Corners property.


FontMetrics

Gets the font metrics.

public PDFFontMetrics FontMetrics { get; internal set; }

Property Value

PDFFontMetrics
The metrics of the font used for displaying the text fragment.


FontSize

Gets the font size.

public double FontSize { get; internal set; }

Property Value

Double
The size of the font used to draw the text on the page.


FriendlyFontName

Gets the friendly font name.

public string FriendlyFontName { get; }

Property Value

String
The friendly name of the font used to draw the text on the page.


Glyphs

Gets the collection of glyphs that compose this fragment.

public PDFTextGlyphCollection Glyphs { get; internal set; }

Property Value

PDFTextGlyphCollection
The glyphs included in this text fragment.


MarkedContentIdentifier

Gets the marked content identifier.

public int MarkedContentIdentifier { get; internal set; }

Property Value

Int32
An integer representing the id of the marked content sequence this text fragment object belongs to.

Remarks

A negative value means the text fragment does not belong to a marked content sequence.


Pen

Gets the pen used for stroking the text outline.

public PDFPen Pen { get; internal set; }

Property Value

PDFPen
The pen used to stroke the text outline.


PostScriptFontName

Gets the PostScript font name.

public string PostScriptFontName { get; internal set; }

Property Value

String
The PostScript name of the font used to draw the text on the page.


StructureElement

Gets the structure element that includes this visual object.

public PDFStructureElement StructureElement { get; }

Property Value

PDFStructureElement
A PDFStructureElement object that includes this visual object.


Text

Gets the text included in the fragment.

public string Text { get; internal set; }

Property Value

String
The text displayed on the page.


TransformedFontSize

Gets the transformed font size.

public double TransformedFontSize { get; }

Property Value

Double
The actual size of the font used to draw the text on the page, it is the PDFTextRun.FontSize transformed by current text matrix.


TypographicCorners

Gets the typographic coordinates of the text fragment corners.

public PDFPoint[] TypographicCorners { get; internal set; }

Property Value

PDFPoint[]
The typographic coordinates on the page of the text fragment's corners.

Remarks

The order of the corners in the array is the following: lower left, lower right, upper right, upper left. The typographic corners consider the font's Descent for the lower corners. The PDFTextRun.Corners property considers the text baseline for the lower corners.


TypographicDisplayBounds

Gets the typographic bounds of the text fragment.

public PDFDisplayRectangle TypographicDisplayBounds { get; }

Property Value

PDFDisplayRectangle
The typographic bounding rectangle of the text fragment in visual coordinates.

Remarks

These bounds are based on the PDFTextRun.TypographicCorners property.


Methods

ExtractTextFragment(Int32, Int32)

Extracts a text fragment from the current fragment starting at the specified position with the given length.

public PDFTextRun ExtractTextFragment(int start, int length)

Parameters

start Int32

length Int32

Returns

PDFTextRun


GetEmbeddedFontData()

Gets the embedded font data.

public Byte[] GetEmbeddedFontData()

Returns

Byte[]
The embedded font data as a byte array if the font is embedded in the PDF file.


ToString()

Gets the text fragment as string.

public string ToString()

Returns

String
The text fragment as string.