Class
Block

Flowing-content container that lays out inline elements, images, and forms with indentation, spacing, alignment, and background for pagination. Use it to accumulate and arrange runs and inline content before measuring and drawing onto the document.

Definition

Constructors

Block()

Initializes a new instance of the Block class.

Declaration

cs-api-definition
public Block()

Block(Block)

Initializes a new instance of the Block class.

Declaration

cs-api-definition
public Block(Block other)

Parameters

other

Block

The other block.

Properties

ActualSize

Gets the actual size of the block after it is drawn.

Declaration

cs-api-definition
public Size ActualSize { get; }

Property Value

Size

The actual size.

BackgroundColor

Gets or sets the background color.

Declaration

cs-api-definition
public ColorBase BackgroundColor { get; set; }

Property Value

ColorBase

The background color.

Bullet

Gets or sets the bullet element.

Declaration

cs-api-definition
public PositionContentElement Bullet { get; set; }

Property Value

PositionContentElement

The bullet element.

DesiredSize

Gets the desired size.

Declaration

cs-api-definition
public Size DesiredSize { get; }

Property Value

Size

The desired size.

Implements IBlockElement.DesiredSize

FirstLineIndent

Gets or sets the first line indent.

Declaration

cs-api-definition
public double FirstLineIndent { get; set; }

Property Value

double

The first line indent.

HasOpenMarkedContent

Gets a value indicating whether this block has any open marked content segments that haven't been closed. Marked content is used to identify specific content within a PDF for various purposes such as accessibility, structure, or logical organization.

Declaration

cs-api-definition
public bool HasOpenMarkedContent { get; }

Property Value

bool

true if this block has open marked content segments; otherwise, false.

Implements IBlockElement.HasOpenMarkedContent

HasPendingContent

Gets if there is any pending content after the last measure.

Declaration

cs-api-definition
public bool HasPendingContent { get; }

Property Value

bool

Boolean value indicating whether there is any pending content after the last measure.

Implements IBlockElement.HasPendingContent

HorizontalAlignment

Gets or sets the horizontal alignment.

Declaration

cs-api-definition
public HorizontalAlignment HorizontalAlignment { get; set; }

Property Value

HorizontalAlignment

The horizontal alignment.

IndentAfterBullet

Gets or sets the indent after the bullet element.

Declaration

cs-api-definition
public double IndentAfterBullet { get; set; }

Property Value

double

The indent after the bullet element.

IsEmpty

Indicates if the block contains any elements.

Declaration

cs-api-definition
public bool IsEmpty { get; }

Property Value

bool

True if the block does not contain any elements.

LeftIndent

Gets or sets the left indent.

Declaration

cs-api-definition
public double LeftIndent { get; set; }

Property Value

double

The left indent.

LineSpacing

Gets or sets the line spacing.

Declaration

cs-api-definition
public double LineSpacing { get; set; }

Property Value

double

The line spacing.

LineSpacingType

Gets or sets the value indicating how the spacing between lines is calculated.

Declaration

cs-api-definition
public HeightType LineSpacingType { get; set; }

Property Value

HeightType

The type line spacing rule.

PendingElements

Gets the pending elements.

Declaration

cs-api-definition
public IEnumerable<LayoutElementBase> PendingElements { get; }

Property Value

IEnumerable<LayoutElementBase>

The pending elements.

RightIndent

Gets or sets the right indent.

Declaration

cs-api-definition
public double RightIndent { get; set; }

Property Value

double

The right indent.

SpacingAfter

Gets or sets the spacing after.

Declaration

cs-api-definition
public double SpacingAfter { get; set; }

Property Value

double

The spacing after.

SpacingBefore

Gets or sets the spacing before.

Declaration

cs-api-definition
public double SpacingBefore { get; set; }

Property Value

double

The spacing before.

VerticalAlignment

Gets or sets the vertical alignment.

Declaration

cs-api-definition
public VerticalAlignment VerticalAlignment { get; set; }

Property Value

VerticalAlignment

The vertical alignment.

Methods

Clear()

Clears the block children.

Declaration

cs-api-definition
public void Clear()

Draw(FixedContentEditor, Rect)

Draws the block element with the specified editor.

Declaration

cs-api-definition
public void Draw(FixedContentEditor editor, Rect boundingRect)

Parameters

editor

FixedContentEditor

The editor.

boundingRect

Rect

The bounding rectangle.

Implements IBlockElement.Draw(FixedContentEditor, Rect)

Insert(LayoutElementBase)

Inserts the specified layout element.

Declaration

cs-api-definition
public void Insert(LayoutElementBase element)

Parameters

element

LayoutElementBase

The element.

Insert(PositionContentElement)

Inserts the specified element.

Declaration

cs-api-definition
public void Insert(PositionContentElement element)

Parameters

element

PositionContentElement

The element.

InsertCircle(Point, double)

Inserts a circle.

Declaration

cs-api-definition
public void InsertCircle(Point center, double radius)

Parameters

center

Point

The center.

radius

double

The radius.

InsertEllipse(Point, double, double)

Inserts an ellipse.

Declaration

cs-api-definition
public void InsertEllipse(Point center, double radiusX, double radiusY)

Parameters

center

Point

The center.

radiusX

double

The radius X.

radiusY

double

The radius Y.

InsertForm(FormSource)

Inserts a form.

Declaration

cs-api-definition
public void InsertForm(FormSource source)

Parameters

source

FormSource

The form source.

InsertForm(FormSource, Size)

Inserts a form.

Declaration

cs-api-definition
public void InsertForm(FormSource source, Size size)

Parameters

source

FormSource

The form source.

size

Size

The size.

InsertForm(FormSource, double, double)

Inserts a form.

Declaration

cs-api-definition
public void InsertForm(FormSource source, double width, double height)

Parameters

source

FormSource

The form source.

width

double

The width.

height

double

The height.

InsertHyperlinkEnd()

Inserts hyperlink end.

Declaration

cs-api-definition
public void InsertHyperlinkEnd()

InsertHyperlinkStart(Destination)

Inserts hyperlink start.

Declaration

cs-api-definition
public void InsertHyperlinkStart(Destination destination)

Parameters

destination

Destination

The destination.

InsertHyperlinkStart(Uri)

Inserts hyperlink start.

Declaration

cs-api-definition
public void InsertHyperlinkStart(Uri uri)

Parameters

uri

Uri

The URI.

InsertImage(ImageSource)

Inserts an image represented by an existing ImageSource at its intrinsic size.

Declaration

cs-api-definition
public void InsertImage(ImageSource source)

Parameters

source

ImageSource

The image source.

InsertImage(ImageSource, Size)

Inserts an ImageSource scaled to the specified size.

Declaration

cs-api-definition
public void InsertImage(ImageSource source, Size size)

Parameters

source

ImageSource

The image source.

size

Size

Target size.

InsertImage(ImageSource, double, double)

Inserts an ImageSource scaled to the specified width and height.

Declaration

cs-api-definition
public void InsertImage(ImageSource source, double width, double height)

Parameters

source

ImageSource

The image source.

width

double

Target width.

height

double

Target height.

InsertImage(Stream)

Inserts an image from a stream at its intrinsic size at the current inline position in the block.

Declaration

cs-api-definition
public void InsertImage(Stream stream)

Parameters

stream

Stream

The stream containing the encoded image data.

InsertImage(Stream, Size)

Inserts an image from a stream scaled to the specified size.

Declaration

cs-api-definition
public void InsertImage(Stream stream, Size size)

Parameters

stream

Stream

The stream containing the encoded image data.

size

Size

Target size.

InsertImage(Stream, double, double)

Inserts an image from a stream scaled to the specified width and height.

Declaration

cs-api-definition
public void InsertImage(Stream stream, double width, double height)

Parameters

stream

Stream

The stream containing the encoded image data.

width

double

Target width.

height

double

Target height.

InsertLine(Point, Point)

Inserts a line.

Declaration

cs-api-definition
public void InsertLine(Point point1, Point point2)

Parameters

point1

Point

The point1.

point2

Point

The point2.

InsertLineBreak()

Inserts a line break.

Declaration

cs-api-definition
public void InsertLineBreak()

InsertMarkedContentEnd()

Inserts marked content end.

Declaration

cs-api-definition
public void InsertMarkedContentEnd()

InsertMarkedContentStart(StructureElement)

Inserts marked content start. If no structureTag is provided, the marked content will be tagged as an Artifact.

Declaration

cs-api-definition
public void InsertMarkedContentStart(StructureElement structureTag = null)

Parameters

structureTag

StructureElement

The structure element tag that relates the marked content with the document's structure tree. If null, the content is tagged as an artifact.

InsertPath(GeometryBase)

Inserts a path.

Declaration

cs-api-definition
public void InsertPath(GeometryBase geometry)

Parameters

geometry

GeometryBase

The geometry.

InsertRange(IEnumerable<LayoutElementBase>)

Inserts the specified layout elements.

Declaration

cs-api-definition
public void InsertRange(IEnumerable<LayoutElementBase> elements)

Parameters

elements

IEnumerable<LayoutElementBase>

The elements.

InsertRectangle(Rect)

Inserts a rectangle.

Declaration

cs-api-definition
public void InsertRectangle(Rect rectangle)

Parameters

rectangle

Rect

The rectangle.

InsertText(FontFamily, FontStyle, FontWeight, string)

Inserts the text using the given font family, font style and font weight.

Declaration

cs-api-definition
public void InsertText(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, string text)

Parameters

fontFamily

FontFamily

The font family.

fontStyle

FontStyle

The font style.

fontWeight

FontWeight

The font weight.

text

string

The text.

InsertText(FontFamily, string)

Inserts the text using the given font family.

Declaration

cs-api-definition
public void InsertText(FontFamily fontFamily, string text)

Parameters

fontFamily

FontFamily

The font family.

text

string

The text.

InsertText(string)

Inserts the text.

Declaration

cs-api-definition
public void InsertText(string text)

Parameters

text

string

The text.

Measure()

Measures the block in the infinite size.

Declaration

cs-api-definition
public Size Measure()

Returns

Size

The block size.

Measure(Size)

Measures the block element with specified available size.

Declaration

cs-api-definition
[Obsolete("The method is obsolete. Please use Measure(Size availableSize, CancellationToken cancellationToken) instead.")]
public Size Measure(Size availableSize)

Parameters

availableSize

Size

The available size.

Returns

Size

The result size.

Implements IBlockElement.Measure(Size)

Measure(Size, CancellationToken)

Measures the block element with specified available size.

Declaration

cs-api-definition
public Size Measure(Size availableSize, CancellationToken cancellationToken)

Parameters

availableSize

Size

The available size.

cancellationToken

CancellationToken

The cancellation token used to cancel the operation.

Returns

Size

The result size.

Implements IBlockElement.Measure(Size, CancellationToken)

SetBullet(List, int)

Sets the bullet from the corresponding list and list level.

Declaration

cs-api-definition
public void SetBullet(List list, int listLevel)

Parameters

list

List

The list.

listLevel

int

The list level.

Split()

Splits this instance.

Declaration

cs-api-definition
public Block Split()

Returns

Block

The remaining block.

ToString()

Returns a string that represents the current object.

Declaration

cs-api-definition
public override string ToString()

Returns

string

A string that represents the current object.

Overrides object.ToString()