Package com.itextpdf.layout.renderer
Class DocumentRenderer
- java.lang.Object
-
- com.itextpdf.layout.renderer.AbstractRenderer
-
- com.itextpdf.layout.renderer.RootRenderer
-
- com.itextpdf.layout.renderer.DocumentRenderer
-
- All Implemented Interfaces:
IPropertyContainer,IRenderer
- Direct Known Subclasses:
ColumnDocumentRenderer
public class DocumentRenderer extends RootRenderer
-
-
Field Summary
Fields Modifier and Type Field Description protected Documentdocumentprotected TargetCounterHandlertargetCounterHandlerprotected java.util.List<java.lang.Integer>wrappedContentPage-
Fields inherited from class com.itextpdf.layout.renderer.RootRenderer
currentArea, floatRendererAreas, immediateFlush, waitingDrawingElements
-
Fields inherited from class com.itextpdf.layout.renderer.AbstractRenderer
BOTTOM_SIDE, childRenderers, EPS, flushed, INF, isLastRendererForModelElement, LEFT_SIDE, modelElement, occupiedArea, OVERLAP_EPSILON, parent, positionedRenderers, properties, RIGHT_SIDE, TOP_SIDE
-
-
Constructor Summary
Constructors Constructor Description DocumentRenderer(Document document)DocumentRenderer(Document document, boolean immediateFlush)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PageSizeaddNewPage(PageSize customPageSize)Adds new page with defined page size to PDF document.protected PageSizeensureDocumentHasNPages(int n, PageSize customPageSize)Ensures that PDF document has n pages.protected voidflushSingleRenderer(IRenderer resultRenderer)private RectanglegetCurrentPageEffectiveArea(PageSize pageSize)IRenderergetNextRenderer()ForDocumentRenderer, this has a meaning of the renderer that will be used for relayout.LayoutAreagetOccupiedArea()Gets the resultant occupied area after the last call to theIRenderer.layout(LayoutContext)method.TargetCounterHandlergetTargetCounterHandler()Get handler for target-counters.booleanisRelayoutRequired()Indicates if relayout is required for targetCounterHandler.private voidpossiblyFlushPreviousPage(int currentPageNumber)protected LayoutAreaupdateCurrentArea(LayoutResult overflowResult)-
Methods inherited from class com.itextpdf.layout.renderer.RootRenderer
addChild, close, flush, flushWaitingDrawingElements, flushWaitingDrawingElements, getCurrentArea, layout, linkRenderToDocument, shrinkCurrentAreaAndProcessRenderer
-
Methods inherited from class com.itextpdf.layout.renderer.AbstractRenderer
addAllChildRenderers, addAllChildRenderers, addAllProperties, addChildRenderer, alignChildHorizontally, allowLastYLineRecursiveExtraction, applyAbsolutePosition, applyAbsolutePositionIfNeeded, applyAction, applyBorderBox, applyBorderBox, applyDestination, applyDestinationsAndAnnotation, applyLinkAnnotation, applyMargins, applyMargins, applyMarginsBordersPaddings, applyPaddings, applyPaddings, applyRelativePositioningTranslation, beginElementOpacityApplying, beginTransformationIfApplied, calculateAbsolutePdfBBox, calculateAdditionalWidth, calculateBBox, calculatePaddingBorderHeight, calculatePaddingBorderWidth, calculateShiftToPositionBBoxOfPointsAt, clipBackgroundArea, clipBackgroundArea, clipBorderArea, createFontCharacteristics, createXObject, deleteOwnProperty, deleteProperty, draw, drawBackground, drawBorder, drawChildren, drawPositionedChildren, endElementOpacityApplying, endTransformationIfApplied, getAspectRatio, getBackgroundArea, getBorderAreaBBox, getBorderRadii, getBorders, getBorders, getChildRenderers, getDefaultProperty, getFirstYLineRecursively, getInnerAreaBBox, getLastYLineRecursively, getMargins, getMinMaxWidth, getMinMaxWidth, getModelElement, getOccupiedAreaBBox, getOwnProperties, getOwnProperty, getPaddings, getParent, getPdfDocument, getProperty, getProperty, getPropertyAsBoolean, getPropertyAsColor, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFloat, getPropertyAsFont, getPropertyAsInteger, getPropertyAsTransparentColor, getPropertyAsUnitValue, getPropertyAsUnitValue, getRootRenderer, hasAbsoluteUnitValue, hasAspectRatio, hasOwnOrModelProperty, hasOwnProperty, hasProperty, hasRelativeUnitValue, initElementAreas, isAbsolutePosition, isBorderBoxSizing, isFirstOnRootArea, isFirstOnRootArea, isFixedLayout, isFlushed, isKeepTogether, isKeepTogether, isNotFittingHeight, isNotFittingLayoutArea, isNotFittingWidth, isOverflowFit, isOverflowProperty, isOverflowProperty, isOverflowProperty, isPositioned, isRelativePosition, isStaticLayout, logWarningIfGetNextRendererNotOverridden, move, noAbsolutePositionInfo, preparePositionedRendererAndAreaForLayout, processWaitingDrawing, rectangleToPointsList, removeAllChildRenderers, removeChildRenderer, replaceOwnProperty, resolveFirstPdfFont, resolveFirstPdfFont, retrieveHeight, retrieveMaxHeight, retrieveMaxWidth, retrieveMinHeight, retrieveMinWidth, retrieveResolvedDeclaredHeight, retrieveUnitValue, retrieveUnitValue, retrieveWidth, returnBackOwnProperty, setBorders, setChildRenderer, setChildRenderers, setMinMaxWidthBasedOnFixedWidth, setParent, setProperty, setThisAsParent, shrinkOccupiedAreaForAbsolutePosition, toString, transformPoints, updateHeight, updateHeightsOnSplit, updateHeightsOnSplit, updateMaxHeight, updateMinHeight, updateWidth
-
-
-
-
Field Detail
-
document
protected Document document
-
wrappedContentPage
protected java.util.List<java.lang.Integer> wrappedContentPage
-
targetCounterHandler
protected TargetCounterHandler targetCounterHandler
-
-
Method Detail
-
getTargetCounterHandler
public TargetCounterHandler getTargetCounterHandler()
Get handler for target-counters.- Returns:
- the
TargetCounterHandlerinstance
-
isRelayoutRequired
public boolean isRelayoutRequired()
Indicates if relayout is required for targetCounterHandler.- Returns:
- true if relayout is required, false otherwise
-
getOccupiedArea
public LayoutArea getOccupiedArea()
Description copied from class:AbstractRendererGets the resultant occupied area after the last call to theIRenderer.layout(LayoutContext)method.- Specified by:
getOccupiedAreain interfaceIRenderer- Overrides:
getOccupiedAreain classAbstractRenderer- Returns:
LayoutAreainstance
-
getNextRenderer
public IRenderer getNextRenderer()
ForDocumentRenderer, this has a meaning of the renderer that will be used for relayout.- Returns:
- relayout renderer.
-
updateCurrentArea
protected LayoutArea updateCurrentArea(LayoutResult overflowResult)
- Specified by:
updateCurrentAreain classRootRenderer
-
flushSingleRenderer
protected void flushSingleRenderer(IRenderer resultRenderer)
- Specified by:
flushSingleRendererin classRootRenderer
-
addNewPage
protected PageSize addNewPage(PageSize customPageSize)
Adds new page with defined page size to PDF document.- Parameters:
customPageSize- the size of new page, can be null- Returns:
- the page size of created page
-
ensureDocumentHasNPages
protected PageSize ensureDocumentHasNPages(int n, PageSize customPageSize)
Ensures that PDF document has n pages. If document has fewer pages, adds new pages by callingaddNewPage(PageSize)method.- Parameters:
n- the expected number of pages if documentcustomPageSize- the size of created pages, can be null- Returns:
- the page size of the last created page, or null if no page was created
-
possiblyFlushPreviousPage
private void possiblyFlushPreviousPage(int currentPageNumber)
-
-