Skip to content

# PDFFormattedTextBlock

Namespace: O2S.Components.PDF4NET.Graphics.FormattedContent

Defines a formatted block of text.

    public class PDFFormattedTextBlock : PDFFormattedBlock

Inheritance Object → PDFFormattedBlock → PDFFormattedTextBlock

Remarks

All text in the block shares the same formatting attributes.

## Constructors

### PDFFormattedTextBlock()

Initializes a new PDFFormattedTextBlock object.

    public PDFFormattedTextBlock()

### PDFFormattedTextBlock(String)

Initializes a new PDFFormattedTextBlock object.

    public PDFFormattedTextBlock(string text)

Parameters

`text` String
Initial text.

### PDFFormattedTextBlock(String, PDFFont)

Initializes a new PDFFormattedTextBlock object.

    public PDFFormattedTextBlock(string text, PDFFont font)

Parameters

`text` String
Initial text.

`font` PDFFont
For used for displaying the text.

## Properties

### Action

Gets or sets the action.

    public PDFAction Action { get; set; }

Property Value

PDFAction
The action to be executed when the block is clicked.

### BackgroundBaselineOffset

Gets or sets the background baseline offset.

    public double BackgroundBaselineOffset { get; set; }

Property Value

Double
Offset from text baseline for drawing the background.

Remarks

The offset is given in PDF points. By default the background baseline matches the text baseline. If you want to lower it so that it covers the descent part of the text, you can set it to a negative value.

### BackgroundColor

Gets or sets the background color.

    public PDFBrush BackgroundColor { get; set; }

Property Value

PDFBrush
The brush used to fill the text background.

### Font

Gets or sets the font.

    public PDFFont Font { get; set; }

Property Value

PDFFont
The font used to display the text in the block.

### StructureElement

Gets or sets the structure element.

    public PDFStructureElement StructureElement { get; set; }

Property Value

PDFStructureElement
The PDFStructureElement object associated with this block.

Remarks

Set this property to a structure element when the paragraph that includes this block does not have a structure element, otherwise the content will be tagged incorrectly.

### Subscript

Gets the list of text blocks that are used as subscript for this block.

    public List<PDFFormattedTextBlock> Subscript { get; }

Property Value

List<PDFFormattedTextBlock>
List of subscript blocks for this block.

### Superscript

Gets the list of text blocks that are used as superscript for this block.

    public List<PDFFormattedTextBlock> Superscript { get; }

Property Value

List<PDFFormattedTextBlock>
List of superscript blocks for this block.

### Text

Gets or sets the text.

    public string Text { get; set; }

Property Value

String
The text content of the block.

### TextColor

Gets or sets the text color.

    public PDFBrush TextColor { get; set; }

Property Value

PDFBrush
The brush used to draw the text.

## Methods

### ToString()

Converts this object to string representation.

    public string ToString()

Returns

String
This object as string.