New to Telerik Document Processing? Start a free 30-day trial

Block

Class

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

Initializes a new instance of the Block class.

C#
public Block()

Initializes a new instance of the Block class.

C#
public Block(Block other)
Parameters:otherBlock

The other block.

Properties

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

C#
public Size ActualSize { get; }
Property Value:

The actual size.

Gets or sets the background color.

C#
public ColorBase BackgroundColor { get; set; }
Property Value:

The background color.

Gets or sets the bullet element.

C#
public PositionContentElement Bullet { get; set; }
Property Value:

The bullet element.

Gets the desired size.

C#
public Size DesiredSize { get; }
Property Value:

The desired size.

Implements: IBlockElement.DesiredSize

Gets or sets the first line indent.

C#
public double FirstLineIndent { get; set; }
Property Value:

The first line indent.

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.

C#
public bool HasOpenMarkedContent { get; }
Property Value:

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

Implements: IBlockElement.HasOpenMarkedContent

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

C#
public bool HasPendingContent { get; }
Property Value:

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

Implements: IBlockElement.HasPendingContent

Gets or sets the horizontal alignment.

C#
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value:

The horizontal alignment.

Gets or sets the indent after the bullet element.

C#
public double IndentAfterBullet { get; set; }
Property Value:

The indent after the bullet element.

Indicates if the block contains any elements.

C#
public bool IsEmpty { get; }
Property Value:

True if the block does not contain any elements.

Gets or sets the left indent.

C#
public double LeftIndent { get; set; }
Property Value:

The left indent.

Gets or sets the line spacing.

C#
public double LineSpacing { get; set; }
Property Value:

The line spacing.

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

C#
public HeightType LineSpacingType { get; set; }
Property Value:

The type line spacing rule.

Gets the pending elements.

C#
public IEnumerable<LayoutElementBase> PendingElements { get; }
Property Value:

The pending elements.

Gets or sets the right indent.

C#
public double RightIndent { get; set; }
Property Value:

The right indent.

Gets or sets the spacing after.

C#
public double SpacingAfter { get; set; }
Property Value:

The spacing after.

Gets or sets the spacing before.

C#
public double SpacingBefore { get; set; }
Property Value:

The spacing before.

Gets or sets the vertical alignment.

C#
public VerticalAlignment VerticalAlignment { get; set; }
Property Value:

The vertical alignment.

Methods

Clears the block children.

C#
public void Clear()

Draws the block element with the specified editor.

C#
public void Draw(FixedContentEditor editor, Rect boundingRect)
Parameters:editorFixedContentEditor

The editor.

boundingRectRect

The bounding rectangle.

Implements: IBlockElement.Draw(FixedContentEditor, Rect)

Inserts the specified layout element.

C#
public void Insert(LayoutElementBase element)
Parameters:elementLayoutElementBase

The element.

Inserts the specified element.

C#
public void Insert(PositionContentElement element)
Parameters:elementPositionContentElement

The element.

Inserts a circle.

C#
public void InsertCircle(Point center, double radius)
Parameters:centerPoint

The center.

radiusdouble

The radius.

Inserts an ellipse.

C#
public void InsertEllipse(Point center, double radiusX, double radiusY)
Parameters:centerPoint

The center.

radiusXdouble

The radius X.

radiusYdouble

The radius Y.

Inserts a form.

C#
public void InsertForm(FormSource source, double width, double height)
Parameters:sourceFormSource

The form source.

widthdouble

The width.

heightdouble

The height.

Inserts a form.

C#
public void InsertForm(FormSource source, Size size)
Parameters:sourceFormSource

The form source.

sizeSize

The size.

Inserts a form.

C#
public void InsertForm(FormSource source)
Parameters:sourceFormSource

The form source.

Inserts hyperlink end.

C#
public void InsertHyperlinkEnd()

Inserts hyperlink start.

C#
public void InsertHyperlinkStart(Destination destination)
Parameters:destinationDestination

The destination.

Inserts hyperlink start.

C#
public void InsertHyperlinkStart(Uri uri)
Parameters:uriUri

The URI.

Inserts an ImageSource scaled to the specified width and height.

C#
public void InsertImage(ImageSource source, double width, double height)
Parameters:sourceImageSource

The image source.

widthdouble

Target width.

heightdouble

Target height.

Inserts an ImageSource scaled to the specified size.

C#
public void InsertImage(ImageSource source, Size size)
Parameters:sourceImageSource

The image source.

sizeSize

Target size.

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

C#
public void InsertImage(ImageSource source)
Parameters:sourceImageSource

The image source.

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

C#
public void InsertImage(Stream stream, double width, double height)
Parameters:streamStream

The stream containing the encoded image data.

widthdouble

Target width.

heightdouble

Target height.

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

C#
public void InsertImage(Stream stream, Size size)
Parameters:streamStream

The stream containing the encoded image data.

sizeSize

Target size.

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

C#
public void InsertImage(Stream stream)
Parameters:streamStream

The stream containing the encoded image data.

Inserts a line.

C#
public void InsertLine(Point point1, Point point2)
Parameters:point1Point

The point1.

point2Point

The point2.

Inserts a line break.

C#
public void InsertLineBreak()

Inserts marked content end.

C#
public void InsertMarkedContentEnd()

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

C#
public void InsertMarkedContentStart(StructureElement structureTag = null)
Parameters:structureTagStructureElement

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

Inserts a path.

C#
public void InsertPath(GeometryBase geometry)
Parameters:geometryGeometryBase

The geometry.

Inserts the specified layout elements.

C#
public void InsertRange(IEnumerable<LayoutElementBase> elements)
Parameters:elementsIEnumerable<LayoutElementBase>

The elements.

Inserts a rectangle.

C#
public void InsertRectangle(Rect rectangle)
Parameters:rectangleRect

The rectangle.

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

C#
public void InsertText(FontFamily fontFamily, FontStyle fontStyle, FontWeight fontWeight, string text)
Parameters:fontFamilyFontFamily

The font family.

fontStyleFontStyle

The font style.

fontWeightFontWeight

The font weight.

textstring

The text.

Inserts the text using the given font family.

C#
public void InsertText(FontFamily fontFamily, string text)
Parameters:fontFamilyFontFamily

The font family.

textstring

The text.

Inserts the text.

C#
public void InsertText(string text)
Parameters:textstring

The text.

Measures the block in the infinite size.

C#
public Size Measure()
Returns:

Size

The block size.

Measures the block element with specified available size.

C#
public Size Measure(Size availableSize, CancellationToken cancellationToken)
Parameters:availableSizeSize

The available size.

cancellationTokenCancellationToken

The cancellation token used to cancel the operation.

Returns:

Size

The result size.

Implements: IBlockElement.Measure(Size, CancellationToken)

Sets the bullet from the corresponding list and list level.

C#
public void SetBullet(List list, int listLevel)
Parameters:listList

The list.

listLevelint

The list level.

Splits this instance.

C#
public Block Split()
Returns:

Block

The remaining block.

Returns a string that represents the current object.

C#
public override string ToString()
Returns:

string

A string that represents the current object.

Overrides: object.ToString()