Class FormFieldValueNonTrimmingTextRenderer
- java.lang.Object
-
- com.itextpdf.layout.renderer.AbstractRenderer
-
- com.itextpdf.layout.renderer.TextRenderer
-
- com.itextpdf.forms.form.renderer.FormFieldValueNonTrimmingTextRenderer
-
- All Implemented Interfaces:
IPropertyContainer
,ILeafElementRenderer
,IRenderer
class FormFieldValueNonTrimmingTextRenderer extends TextRenderer
Custom implementation for rendering form field values. It makes sure that text value trimming strategy matches Acrobat's behavior
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
callTrimFirst
-
Fields inherited from class com.itextpdf.layout.renderer.TextRenderer
line, otfFeaturesApplied, reversedRanges, savedWordBreakAtLineEnding, strToBeConverted, tabAnchorCharacterPosition, text, TEXT_SPACE_COEFF, yLineOffset
-
Fields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
childRenderers, EPS, flushed, INF, isLastRendererForModelElement, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties
-
-
Constructor Summary
Constructors Constructor Description FormFieldValueNonTrimmingTextRenderer(Text textElement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TextRenderer
createCopy(GlyphLine gl, PdfFont font)
IRenderer
getNextRenderer()
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifTextRenderer.layout(LayoutContext)
is called more than once.LayoutResult
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.private void
setCallTrimFirst(boolean callTrimFirst)
void
trimFirst()
Trims any whitespace characters from the start of theGlyphLine
to be rendered.-
Methods inherited from class com.itextpdf.layout.renderer.TextRenderer
applyOtf, baseCharactersCount, calculateAscenderDescender, calculateAscenderDescender, calculateLineWidth, charAt, createOverflowRenderer, createSplitRenderer, draw, drawSingleUnderline, getAscent, getBackgroundArea, getDescent, getFirstYLineRecursively, getLastYLineRecursively, getMinMaxWidth, getNumberOfSpaces, getTabAnchorCharacterPosition, getText, getYLine, length, lineLength, moveYLineTo, resolveFonts, setProcessedGlyphLineAndFont, setText, setText, split, toString
-
Methods 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, drawChildren, endElementOpacityApplying, endTransformationIfApplied, getBorderAreaBBox, getBorderRadii, getBorders, getChildRenderers, getDefaultProperty, getInnerAreaBBox, getMargins, getModelElement, getOccupiedArea, getOccupiedAreaBBox, 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, move, rectangleToPointsList, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveUnitValue, retrieveUnitValue, retrieveWidth, setBorders, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, transformPoints, updateHeight, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.itextpdf.layout.IPropertyContainer
deleteOwnProperty, getDefaultProperty, getOwnProperty, getProperty, hasOwnProperty, hasProperty, setProperty
-
Methods inherited from interface com.itextpdf.layout.renderer.IRenderer
addChild, getChildRenderers, getModelElement, getOccupiedArea, getParent, getProperty, isFlushed, move, setParent
-
-
-
-
Constructor Detail
-
FormFieldValueNonTrimmingTextRenderer
public FormFieldValueNonTrimmingTextRenderer(Text textElement)
-
-
Method Detail
-
getNextRenderer
public IRenderer getNextRenderer()
Description copied from class:TextRenderer
Gets a new instance of this class to be used as a next renderer, after this renderer is used, ifTextRenderer.layout(LayoutContext)
is called more than once.If
TextRenderer
overflows to the next line, iText uses this method to create a renderer for the overflow part. So if one wants to extendTextRenderer
, one should override this method: otherwise the default method will be used and thus the default rather than the custom renderer will be created. Another method that should be overridden in case ofTextRenderer
's extension isTextRenderer.createCopy(GlyphLine, PdfFont)
. This method is responsible for creation ofTextRenderer
's copies, which represent its parts of specific font.- Specified by:
getNextRenderer
in interfaceIRenderer
- Overrides:
getNextRenderer
in classTextRenderer
- Returns:
- new renderer instance
-
layout
public LayoutResult layout(LayoutContext layoutContext)
Description copied from interface:IRenderer
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.LayoutResult
can be extended to return custom layout results for custom elements, e.g.TextRenderer
usesTextLayoutResult
as 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:
layout
in interfaceIRenderer
- Overrides:
layout
in classTextRenderer
- Parameters:
layoutContext
- the description of layout area and any other additional information- Returns:
- result of the layout process
-
trimFirst
public void trimFirst()
Description copied from class:TextRenderer
Trims any whitespace characters from the start of theGlyphLine
to be rendered.- Overrides:
trimFirst
in classTextRenderer
-
createCopy
protected TextRenderer createCopy(GlyphLine gl, PdfFont font)
Creates a copy of thisTextRenderer
, which corresponds to the passedGlyphLine
withPdfFont
.While processing
TextRenderer
, iText uses this method to createglyph lines
of specificfonts
, which represent theTextRenderer
's parts. If one extendsTextRenderer
, one should override this method, otherwise ifFontSelector
related logic is triggered, copies of thisTextRenderer
will have the default behavior rather than the custom one.- Overrides:
createCopy
in classTextRenderer
- Parameters:
gl
- aGlyphLine
which represents some of thisTextRenderer
's contentfont
- aPdfFont
for this part of theTextRenderer
's content- Returns:
- copy of this
TextRenderer
, which correspond to the passedGlyphLine
withPdfFont
-
setCallTrimFirst
private void setCallTrimFirst(boolean callTrimFirst)
-
-