Package com.openhtmltopdf.render
Class PageBox
- java.lang.Object
-
- com.openhtmltopdf.render.PageBox
-
public class PageBox extends Object
-
-
Constructor Summary
Constructors Constructor Description PageBox()
-
Method Summary
Modifier and Type Method Description voidexportLeadingText(RenderingContext c, Writer writer)voidexportTrailingText(RenderingContext c, Writer writer)intgetBasePagePdfPageIndex()intgetBottom()intgetContentHeight(CssContext cssCtx)intgetContentWidth(CssContext cssCtx)MarginBoxName[]getCurrentMarginBoxNames()IdentValuegetCutOffPageDirection()RectanglegetDocumentCoordinatesContentBounds(CssContext c)Get the rectangle that this page's content area will cover of the layed out document.RectanglegetDocumentCoordinatesContentBoundsForInsertedPage(CssContext c, int shadowPageNumber)Get the shadow page (a page inserted to carry cut off content) content area of the layed out document.intgetHeight(CssContext cssCtx)RectPropertySetgetMargin(CssContext cssCtx)intgetMarginBorderPadding(CssContext cssCtx, int which)intgetMaxInsertedPages()The maximum number of shadow pages to insert for cut-off content.intgetMaxShadowPagesForXPos(CssContext c, int x)Returns the number of shadow pages needed for a given x coordinate.ElementgetMetadata()intgetOuterPageWidth()RectanglegetPagedViewClippingBounds(CssContext cssCtx, int additionalClearance)PageInfogetPageInfo()intgetPageNo()intgetPaintingBottom()intgetPaintingTop()Example: If a page is 100 units high and has a 10 unit margin, this will return 0 for the first page and 80 for the second and so on.RectanglegetPrintClippingBounds(CssContext cssCtx)RectanglegetPrintPaintingBounds(CssContext cssCtx)RectanglegetScreenPaintingBounds(CssContext cssCtx, int additionalClearance)intgetShadowPageCount()CalculatedStylegetStyle()intgetTop()intgetWidth(CssContext cssCtx)booleanisLeftPage()booleanisRightPage()voidlayout(LayoutContext c)voidpaintBackground(RenderingContext c, int additionalClearance, short mode)voidpaintBorder(RenderingContext c, int additionalClearance, short mode)voidpaintMarginAreas(RenderingContext c, int additionalClearance, short mode)voidsetBasePagePdfPageIndex(int idx)voidsetOuterPageWidth(int containingBlockWidth)voidsetPageInfo(PageInfo pageInfo)voidsetPageNo(int pageNo)voidsetPaintingBottom(int paintingBottom)voidsetPaintingTop(int paintingTop)voidsetShadowPageCount(int cnt)voidsetStyle(CalculatedStyle style)voidsetTopAndBottom(CssContext cssCtx, int top)booleanshouldInsertPages()Should shadow pages be inserted for cut off content for this page.
-
-
-
Method Detail
-
setBasePagePdfPageIndex
public void setBasePagePdfPageIndex(int idx)
-
setShadowPageCount
public void setShadowPageCount(int cnt)
-
getBasePagePdfPageIndex
public int getBasePagePdfPageIndex()
-
getShadowPageCount
public int getShadowPageCount()
-
getWidth
public int getWidth(CssContext cssCtx)
-
getHeight
public int getHeight(CssContext cssCtx)
-
getContentHeight
public int getContentHeight(CssContext cssCtx)
-
getContentWidth
public int getContentWidth(CssContext cssCtx)
-
getStyle
public CalculatedStyle getStyle()
-
setStyle
public void setStyle(CalculatedStyle style)
-
getBottom
public int getBottom()
-
getTop
public int getTop()
-
setTopAndBottom
public void setTopAndBottom(CssContext cssCtx, int top)
-
getPaintingBottom
public int getPaintingBottom()
-
setPaintingBottom
public void setPaintingBottom(int paintingBottom)
-
getPaintingTop
public int getPaintingTop()
Example: If a page is 100 units high and has a 10 unit margin, this will return 0 for the first page and 80 for the second and so on.- Returns:
- the y index into the document coordinates.
-
setPaintingTop
public void setPaintingTop(int paintingTop)
-
getScreenPaintingBounds
public Rectangle getScreenPaintingBounds(CssContext cssCtx, int additionalClearance)
-
getPrintPaintingBounds
public Rectangle getPrintPaintingBounds(CssContext cssCtx)
-
getDocumentCoordinatesContentBounds
public Rectangle getDocumentCoordinatesContentBounds(CssContext c)
Get the rectangle that this page's content area will cover of the layed out document. For example: If a page is 100 units high and 150 wide and has a margin of 10 then this method will return a rect(0, 0, 130, 80) for the first page and a rect(0, 80, 130, 80) for the second and so on.
-
getDocumentCoordinatesContentBoundsForInsertedPage
public Rectangle getDocumentCoordinatesContentBoundsForInsertedPage(CssContext c, int shadowPageNumber)
Get the shadow page (a page inserted to carry cut off content) content area of the layed out document. For example: If a page one is 100 units high and 150 wide and has a margin of 10 then this will return a rect(130, 0, 130, 80) for the first shadow page and a rect(260, 0, 130, 80) for the second shadow page assuming cut-off direction is LTR. For RTL the rects would be rect(-130, 0, 130, 80) and rect(-260, 0, 130, 80).
-
getMaxShadowPagesForXPos
public int getMaxShadowPagesForXPos(CssContext c, int x)
Returns the number of shadow pages needed for a given x coordinate. For example if x = 800 and content width = 1000 returns 0 (assumes LTR). For example if x = 2400 and content width = 900 returns 2 (assumes LTR).
-
shouldInsertPages
public boolean shouldInsertPages()
Should shadow pages be inserted for cut off content for this page.
-
getMaxInsertedPages
public int getMaxInsertedPages()
The maximum number of shadow pages to insert for cut-off content.
-
getCutOffPageDirection
public IdentValue getCutOffPageDirection()
- Returns:
- Either ltr (should insert cut-off content to the right of the page) or rtl (should insert cut-off content to the left of the page).
-
getPagedViewClippingBounds
public Rectangle getPagedViewClippingBounds(CssContext cssCtx, int additionalClearance)
-
getPrintClippingBounds
public Rectangle getPrintClippingBounds(CssContext cssCtx)
-
getMargin
public RectPropertySet getMargin(CssContext cssCtx)
-
paintBorder
public void paintBorder(RenderingContext c, int additionalClearance, short mode)
-
paintBackground
public void paintBackground(RenderingContext c, int additionalClearance, short mode)
-
paintMarginAreas
public void paintMarginAreas(RenderingContext c, int additionalClearance, short mode)
-
getCurrentMarginBoxNames
public MarginBoxName[] getCurrentMarginBoxNames()
-
getPageNo
public int getPageNo()
-
setPageNo
public void setPageNo(int pageNo)
-
getOuterPageWidth
public int getOuterPageWidth()
-
setOuterPageWidth
public void setOuterPageWidth(int containingBlockWidth)
-
getMarginBorderPadding
public int getMarginBorderPadding(CssContext cssCtx, int which)
-
getPageInfo
public PageInfo getPageInfo()
-
setPageInfo
public void setPageInfo(PageInfo pageInfo)
-
getMetadata
public Element getMetadata()
-
layout
public void layout(LayoutContext c)
-
isLeftPage
public boolean isLeftPage()
-
isRightPage
public boolean isRightPage()
-
exportLeadingText
public void exportLeadingText(RenderingContext c, Writer writer) throws IOException
- Throws:
IOException
-
exportTrailingText
public void exportTrailingText(RenderingContext c, Writer writer) throws IOException
- Throws:
IOException
-
-