Click or drag to resize

PdfFormattedText Class

Provides control for drawing text in PDF document.
Inheritance Hierarchy
SystemObject
  SautinSoft.Pdf.ContentPdfFormattedText

Namespace: SautinSoft.Pdf.Content
Assembly: SautinSoft.Pdf (in SautinSoft.Pdf.dll) Version: 2026.5.19
Syntax
public sealed class PdfFormattedText : IDisposable

The PdfFormattedText type exposes the following members.

Constructors
 NameDescription
Public methodPdfFormattedText Initializes a new instance of the PdfFormattedText class.
Top
Properties
 NameDescription
Public propertyColor Gets or sets the color for the characters appended next to the PdfFormattedText object.
Public propertyFont Gets or sets the font for the characters appended next to the PdfFormattedText object.
Public propertyFontFace Gets or sets the font face for the characters appended next to the PdfFormattedText object.
Public propertyFontFamily Gets or sets the font family for the characters appended next to the PdfFormattedText object.
Public propertyFontSize Gets or sets the font size, in points (1/72 inch per point), for the characters appended next to the PdfFormattedText object.
Public propertyFontStretch Gets or sets the font stretch for the characters appended next to the PdfFormattedText object.
Public propertyFontStyle Gets or sets the font style for the characters appended next to the PdfFormattedText object.
Public propertyFontWeight Gets or sets the font weight for the characters appended next to the PdfFormattedText object.
Public propertyHeight Gets the distance from the top of the first line to the bottom of the last line of the PdfFormattedText object.
Public propertyKerning

Gets ot sets the minimum fonts size for a character kerning.

Initial value: 0.

Public propertyLanguage Gets or sets the language for the characters appended next to the PdfFormattedText object.
Public propertyLength

Gets the total number of PdfFormattedText positions.

Should be used with the FormatLine(Int32, Double) method and the Length property.

Public propertyLineHeight Gets or sets the line height, or line spacing, between lines of text.
Public propertyMaxTextWidth Gets or sets the maximum text width for a line of text.
Public propertyMaxTextWidths Gets or sets the array of maximum text widths within the PdfFormattedText, on a per-line basis. Each element in the array represents the maximum text width of sequential lines of text.
Public propertyOpacity Gets or sets the opacity for the characters appended next to the PdfFormattedText object.
Public propertyTextAlignment Gets or sets the alignment of text within a PdfFormattedText object.
Public propertyTextFormattingMode Gets or sets the text formatting mode.
Public propertyWidth Gets the width between the leading and trailing alignment points of a line, excluding any trailing white-space characters.
Top
Methods
 NameDescription
Public methodAppend Appends the specified string to this PdfFormattedText instance.
Public methodAppendLine Appends the line terminator to the end of the current PdfFormattedText object.
Public methodAppendLine(String) Appends the specified string followed by the line terminator to the end of the current PdfFormattedText object.
Public methodClear Removes all characters from the current PdfFormattedText instance.
Public methodDispose Releases all managed and unmanaged resources used by the PdfFormattedText object.
Public methodFormatLine

Creates a PdfFormattedTextLine that starts with the specified character index and is of the specified maximum width.

This method allows incremental breaking of a PdfFormattedText to PdfFormattedTextLines.

It is useful in the following scenarios:

  • The PdfFormattedText might contain a lot of text that would be broken in a lot of lines and you only want to draw some of those lines.
  • The PdfFormattedText might not fit to the available height. Then each line should be formatted and, if it fits to the available height, drawn.
  • The PdfFormattedText might have lines that should have different maxLineWidth or be drawn in a custom location (for example, text contained in a non-rectangular area).

To format the next PdfFormattedTextLine, increment the firstCharIndex by Length of the current PdfFormattedTextLine, until firstCharIndex is greater than or equal to the Length.

Use method DrawText(PdfFormattedTextLine, PdfPoint) to draw the PdfFormattedTextLine.

Public methodToString Converts the value of this instance to a String.
(Overrides ObjectToString)
Top
See Also