Package com.itextpdf.layout.renderer
Class ParagraphRenderer
java.lang.Object
com.itextpdf.layout.renderer.AbstractRenderer
com.itextpdf.layout.renderer.BlockRenderer
com.itextpdf.layout.renderer.ParagraphRenderer
- All Implemented Interfaces:
-
IPropertyContainer,IRenderer
- Direct Known Subclasses:
-
AnonymousInlineBoxRenderer,CheckBoxRenderer.FlatParagraphRenderer
This class represents the
renderer object for a Paragraph object. It will draw the glyphs of the textual content on the DrawContext.
-
Field Summary
FieldsFields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties -
Constructor Summary
ConstructorsConstructorDescriptionParagraphRenderer(Paragraph modelElement) Creates a ParagraphRenderer from its corresponding layout object. -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractRenderercreateOverflowRenderer(int layoutResult) Creates an overflow renderer.protected ParagraphRenderercreateOverflowRenderer(IRenderer parent) protected ParagraphRenderercreateSplitRenderer(IRenderer parent) protected LayoutResultdirectLayout(LayoutContext layoutContext) voiddrawChildren(DrawContext drawContext) Performs the drawing operation for allchildrenof this renderer.T1 getDefaultProperty(int property) Gets the default property from this entity.protected FloatGets the first yLine of the nested children recursively.protected FloatgetLines()Gets the lines which are the result of thelayout(LayoutContext).Calculates min and max width values for current renderer.Gets a new instance of this class to be used as a next renderer, after this renderer is used, iflayout(LayoutContext)is called more than once.layout(LayoutContext layoutContext) This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult, representing the layout result, including occupied area, status, i.e.voidmove(float dxRight, float dyUp) Moves the renderer subtree by the specified offset.protected ParagraphRenderer[]split()toString()Returns a string representation of the renderer.Methods inherited from class com.itextpdf.layout.renderer.BlockRenderer
applyRotationLayout, applyVerticalAlignment, beginRotationIfApplied, createRotationTransformInsideOccupiedArea, createSplitRenderer, draw, endRotationIfApplied, getMinMaxWidth, getOccupiedAreaBBox, getResolvedFontMethods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllProperties, addChild, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAction, applyBorderBox, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyPaddings, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateBBox, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createXObject, deleteOwnProperty, deleteProperty, drawBackground, drawBorder, endElementOpacityApplying, endTransformationIfApplied, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getChildRenderers, getInnerAreaBBox, getMargins, getModelElement, getOccupiedArea, getOwnProperties, getOwnProperty, getPaddings, getParent, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, hasAbsoluteUnitValue, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveResolvedDeclaredHeight, retrieveUnitValue, retrieveUnitValue, retrieveWidth, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
-
Field Details
-
lines
-
-
Constructor Details
-
ParagraphRenderer
Creates a ParagraphRenderer from its corresponding layout object.- Parameters:
-
modelElement- theParagraphwhich this object should manage
-
-
Method Details
-
layout
This method simulates positioning of the renderer, including all of its children, and returns theLayoutResult, representing the layout result, including occupied area, status, i.e. if there was enough place to fit the renderer subtree, etc.LayoutResultcan be extended to return custom layout results for custom elements, e.g.TextRendererusesTextLayoutResultas its result. This method can be called standalone to learn how much area the renderer subtree needs, or can be called beforeIRenderer.draw(DrawContext), to prepare the renderer to be flushed to the output stream.- Specified by:
-
layoutin interfaceIRenderer - Overrides:
-
layoutin classBlockRenderer - Parameters:
-
layoutContext- the description of layout area and any other additional information - Returns:
- result of the layout process
-
directLayout
-
getNextRenderer
Gets a new instance of this class to be used as a next renderer, after this renderer is used, iflayout(LayoutContext)is called more than once.If a renderer overflows to the next area, iText uses this method to create a renderer for the overflow part. So if one wants to extend
ParagraphRenderer, one should override this method: otherwise the default method will be used and thus the default rather than the custom renderer will be created.- Returns:
- new renderer instance
-
getDefaultProperty
publicT1 getDefaultProperty (int property) Gets the default property from this entity.- Specified by:
-
getDefaultPropertyin interfaceIPropertyContainer - Overrides:
-
getDefaultPropertyin classAbstractRenderer - Type Parameters:
-
T1- the return type associated with the property - Parameters:
-
property- the property to be retrieved - Returns:
-
the default property value. If the default property is not defined,
nullwill be returned
-
toString
Returns a string representation of the renderer.- Overrides:
-
toStringin classAbstractRenderer - Returns:
-
a
String - See Also:
-
drawChildren
Performs the drawing operation for allchildrenof this renderer.- Overrides:
-
drawChildrenin classAbstractRenderer - Parameters:
-
drawContext- the context (canvas, document, etc) of this drawing operation.
-
move
public void move(float dxRight, float dyUp) Moves the renderer subtree by the specified offset. This method affects occupied area of the renderer.- Specified by:
-
movein interfaceIRenderer - Overrides:
-
movein classAbstractRenderer - Parameters:
-
dxRight- the x-axis offset in points. Positive value will move the renderer subtree to the right. -
dyUp- the y-axis offset in points. Positive value will move the renderer subtree to the top.
-
getLines
Gets the lines which are the result of thelayout(LayoutContext).- Returns:
-
paragraph lines, or
nullif layout hasn't been called yet
-
getFirstYLineRecursively
Description copied from class:AbstractRendererGets the first yLine of the nested children recursively. E.g. for a list, this will be the yLine of the first item (if the first item is indeed a paragraph). NOTE: this method will no go further than the first child.- Overrides:
-
getFirstYLineRecursivelyin classAbstractRenderer - Returns:
- the first yline of the nested children, null if there is no text found
-
getLastYLineRecursively
- Overrides:
-
getLastYLineRecursivelyin classAbstractRenderer
-
createOverflowRenderer
-
createSplitRenderer
-
createOverflowRenderer
Description copied from class:BlockRendererCreates an overflow renderer.- Overrides:
-
createOverflowRendererin classBlockRenderer - Parameters:
-
layoutResult- the result of content layouting - Returns:
-
a new
AbstractRendererinstance
-
getMinMaxWidth
Description copied from class:BlockRendererCalculates min and max width values for current renderer.- Overrides:
-
getMinMaxWidthin classBlockRenderer - Returns:
-
instance of
MinMaxWidth
-
split
-