iText 8.0.5 API
iText.Layout.Renderer.IRenderer Interface Reference

A renderer object is responsible for drawing a corresponding layout object on a document or canvas. More...

Inheritance diagram for iText.Layout.Renderer.IRenderer:
iText.Layout.IPropertyContainer iText.Layout.Renderer.AbstractRenderer iText.Layout.Renderer.AreaBreakRenderer iText.Layout.Renderer.ILeafElementRenderer iText.Layout.Renderer.BlockRenderer iText.Layout.Renderer.ImageRenderer iText.Layout.Renderer.LineRenderer iText.Layout.Renderer.MulticolRenderer iText.Layout.Renderer.RootRenderer iText.Layout.Renderer.TableRenderer iText.Layout.Renderer.TabRenderer iText.Layout.Renderer.TextRenderer iText.Layout.Renderer.ImageRenderer iText.Layout.Renderer.TextRenderer

Public Member Functions

void  AddChild (IRenderer renderer)
  Adds a child to the current renderer More...
 
LayoutResult  Layout (LayoutContext layoutContext)
  This method simulates positioning of the renderer, including all of its children, and returns the iText.Layout.Layout.LayoutResult , representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc. More...
 
void  Draw (DrawContext drawContext)
  Flushes the renderer subtree contents, i.e. draws itself on canvas, adds necessary objects to the iText.Kernel.Pdf.PdfDocument etc. More...
 
LayoutArea  GetOccupiedArea ()
  Gets the resultant occupied area after the last call to the Layout(iText.Layout.Layout.LayoutContext) method. More...
 
T1  GetProperty< T1 > (int property, T1 defaultValue)
  Gets a property from this entity or one of its hierarchical parents. More...
 
IRenderer  SetParent (IRenderer parent)
  Explicitly sets this object as the child of another IRenderer in the renderer hierarchy. More...
 
IRenderer  GetParent ()
  Gets the parent IRenderer. More...
 
IPropertyContainer  GetModelElement ()
  Gets the model element associated with this renderer. More...
 
IList< IRenderer GetChildRenderers ()
  Gets the child IRenderer s. More...
 
bool  IsFlushed ()
  Indicates whether this renderer is flushed or not, i.e. if Draw(DrawContext) has already been called. More...
 
void  Move (float dx, float dy)
  Moves the renderer subtree by the specified offset. More...
 
IRenderer  GetNextRenderer ()
  Gets a new instance of this class to be used as a next renderer, after this renderer is used, if Layout(iText.Layout.Layout.LayoutContext) is called more than once. More...
 
- Public Member Functions inherited from iText.Layout.IPropertyContainer
bool  HasProperty (int property)
  Checks if this entity has the specified property. More...
 
bool  HasOwnProperty (int property)
  Checks if this entity has the specified property, i.e. if it was set to this very element earlier More...
 
T1  GetProperty< T1 > (int property)
  Gets the property from this entity. More...
 
T1  GetOwnProperty< T1 > (int property)
  Gets own property from this entity. More...
 
T1  GetDefaultProperty< T1 > (int property)
  Gets the default property from this entity. More...
 
void  SetProperty (int property, Object value)
  Sets a property for this entity. More...
 
void  DeleteOwnProperty (int property)
  Deletes the own property of this entity. More...
 

Detailed Description

A renderer object is responsible for drawing a corresponding layout object on a document or canvas.

A renderer object is responsible for drawing a corresponding layout object on a document or canvas. Every layout object has a renderer, by default one of the corresponding type, e.g. you can ask an iText.Layout.Element.Image for its ImageRenderer. Renderers are designed to be extensible, and custom implementations can be seeded to layout objects (or their custom subclasses) at runtime.

Member Function Documentation

◆ AddChild()

◆ Draw()

void iText.Layout.Renderer.IRenderer.Draw ( DrawContext  drawContext )

◆ GetChildRenderers()

IList<IRenderer> iText.Layout.Renderer.IRenderer.GetChildRenderers ( )

Gets the child IRenderer s.

Returns
a list of direct child renderers of this instance

Implemented in iText.Layout.Renderer.AbstractRenderer, and iText.Layout.Renderer.AreaBreakRenderer.

◆ GetModelElement()

IPropertyContainer iText.Layout.Renderer.IRenderer.GetModelElement ( )

Gets the model element associated with this renderer.

Returns
the model element, as a container of properties

Implemented in iText.Layout.Renderer.AbstractRenderer, iText.Layout.Renderer.AreaBreakRenderer, and iText.Layout.Renderer.CellRenderer.

◆ GetNextRenderer()

◆ GetOccupiedArea()

LayoutArea iText.Layout.Renderer.IRenderer.GetOccupiedArea ( )

◆ GetParent()

IRenderer iText.Layout.Renderer.IRenderer.GetParent ( )

Gets the parent IRenderer.

Returns
direct parent renderer of this instance

Implemented in iText.Layout.Renderer.AbstractRenderer, and iText.Layout.Renderer.AreaBreakRenderer.

◆ GetProperty< T1 >()

T1 iText.Layout.Renderer.IRenderer.GetProperty< T1 > ( int  property,
T1  defaultValue 
)

Gets a property from this entity or one of its hierarchical parents.

Gets a property from this entity or one of its hierarchical parents. If the property is not found, defaultValue will be returned.

Template Parameters
T1 the return type associated with the property
Parameters
property the property to be retrieved
defaultValue a fallback value
Returns
the value of the given property

Implemented in iText.Layout.Renderer.AbstractRenderer, and iText.Layout.Renderer.AreaBreakRenderer.

◆ IsFlushed()

bool iText.Layout.Renderer.IRenderer.IsFlushed ( )

Indicates whether this renderer is flushed or not, i.e. if Draw(DrawContext) has already been called.

Returns
whether the renderer has been flushed

Implemented in iText.Layout.Renderer.AbstractRenderer, and iText.Layout.Renderer.AreaBreakRenderer.

◆ Layout()

LayoutResult iText.Layout.Renderer.IRenderer.Layout ( LayoutContext  layoutContext )

This method simulates positioning of the renderer, including all of its children, and returns the iText.Layout.Layout.LayoutResult , representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc.

This method simulates positioning of the renderer, including all of its children, and returns the iText.Layout.Layout.LayoutResult , representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc. iText.Layout.Layout.LayoutResult can be extended to return custom layout results for custom elements, e.g. TextRenderer uses iText.Layout.Layout.TextLayoutResult as its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called before Draw(DrawContext) , to prepare the renderer to be flushed to the output stream.

Parameters
layoutContext the description of layout area and any other additional information
Returns
result of the layout process

Implemented in iText.Layout.Renderer.RootRenderer, iText.Layout.Renderer.TableRenderer, iText.Layout.Renderer.TextRenderer, iText.Forms.Form.Renderer.SignatureAppearanceRenderer, iText.Forms.Form.Renderer.AbstractFormFieldRenderer, iText.Forms.Form.Renderer.TextAreaRenderer, iText.Layout.Renderer.ImageRenderer, iText.Layout.Renderer.FlexContainerRenderer, iText.Layout.Renderer.MulticolRenderer, iText.Layout.Renderer.ParagraphRenderer, iText.Layout.Renderer.AreaBreakRenderer, iText.Layout.Renderer.LineRenderer, iText.Forms.Form.Renderer.SelectFieldListBoxRenderer, iText.Layout.Renderer.ListItemRenderer, iText.Layout.Renderer.GridContainerRenderer, iText.Layout.Renderer.BlockRenderer, iText.Forms.Form.Renderer.AbstractSelectFieldRenderer, iText.Layout.Renderer.ListRenderer, iText.Layout.Renderer.TabRenderer, iText.Layout.Renderer.LineSeparatorRenderer, and iText.Layout.Renderer.AbstractRenderer.

◆ Move()

void iText.Layout.Renderer.IRenderer.Move ( float  dx,
float  dy 
)

Moves the renderer subtree by the specified offset.

Moves the renderer subtree by the specified offset. This method affects occupied area of the renderer.

Parameters
dx the x-axis offset in points. Positive value will move the renderer subtree to the right.
dy the y-axis offset in points. Positive value will move the renderer subtree to the top.

Implemented in iText.Layout.Renderer.TableRenderer, iText.Layout.Renderer.AbstractRenderer, iText.Layout.Renderer.ParagraphRenderer, iText.Layout.Renderer.ImageRenderer, and iText.Layout.Renderer.AreaBreakRenderer.

◆ SetParent()

IRenderer iText.Layout.Renderer.IRenderer.SetParent ( IRenderer  parent )

Explicitly sets this object as the child of another IRenderer in the renderer hierarchy.

Explicitly sets this object as the child of another IRenderer in the renderer hierarchy. Some implementations also use this method internally to create a consistent hierarchy tree.

Parameters
parent the object to place higher in the renderer hierarchy
Returns
by default, this object

Implemented in iText.Layout.Renderer.AbstractRenderer, and iText.Layout.Renderer.AreaBreakRenderer.