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 booleancallTrimFirst-
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 TextRenderercreateCopy(GlyphLine gl, PdfFont font)IRenderergetNextRenderer()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.LayoutResultlayout(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 voidsetCallTrimFirst(boolean callTrimFirst)voidtrimFirst()Trims any whitespace characters from the start of theGlyphLineto 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, getMinMaxWidth, 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, retrieveResolvedDeclaredHeight, 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:TextRendererGets 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
TextRendereroverflows 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:
getNextRendererin interfaceIRenderer- Overrides:
getNextRendererin classTextRenderer- Returns:
- new renderer instance
-
layout
public LayoutResult layout(LayoutContext layoutContext)
Description copied from interface:IRendererThis 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 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:TextRendererTrims any whitespace characters from the start of theGlyphLineto be rendered.- Overrides:
trimFirstin classTextRenderer
-
createCopy
protected TextRenderer createCopy(GlyphLine gl, PdfFont font)
Creates a copy of thisTextRenderer, which corresponds to the passedGlyphLinewithPdfFont.While processing
TextRenderer, iText uses this method to createglyph linesof specificfonts, which represent theTextRenderer's parts. If one extendsTextRenderer, one should override this method, otherwise ifFontSelectorrelated logic is triggered, copies of thisTextRendererwill have the default behavior rather than the custom one.- Overrides:
createCopyin classTextRenderer- Parameters:
gl- aGlyphLinewhich represents some of thisTextRenderer's contentfont- aPdfFontfor this part of theTextRenderer's content- Returns:
- copy of this
TextRenderer, which correspond to the passedGlyphLinewithPdfFont
-
setCallTrimFirst
private void setCallTrimFirst(boolean callTrimFirst)
-
-