Package com.openhtmltopdf.render
Class RenderingContext
- java.lang.Object
-
- com.openhtmltopdf.render.RenderingContext
-
- All Implemented Interfaces:
CssContext
,java.lang.Cloneable
public class RenderingContext extends java.lang.Object implements CssContext, java.lang.Cloneable
Supplies information about the context in which rendering will take place
-
-
Field Summary
Fields Modifier and Type Field Description private BidiReorderer
_bidi
private boolean
_isInFloatBottom
private FontContext
fontContext
private int
initialPageNo
private boolean
inPageMargins
private boolean
isFastRenderer
private OutputDevice
outputDevice
private PageBox
page
private int
pageCount
private int
pageNo
private Layer
rootLayer
private int
shadowPageNumber
protected SharedContext
sharedContext
-
Constructor Summary
Constructors Constructor Description RenderingContext(SharedContext sharedContext)
needs a new instance every run
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
boolean
debugDrawBoxes()
boolean
debugDrawFontMetrics()
boolean
debugDrawInlineBoxes()
boolean
debugDrawLineBoxes()
java.lang.String
getBaseURL()
BidiReorderer
getBidiReorderer()
Box
getBoxById(java.lang.String id)
FSCanvas
getCanvas()
StyleReference
getCss()
int
getDotsPerPixel()
float
getDPI()
java.awt.Rectangle
getFixedRectangle(boolean excludeFloatBottomArea)
Get the document (for non-paged docs) or page rect where fixed position boxes should be layed out.FSFont
getFont(FontSpecification font)
FontContext
getFontContext()
FontResolver
getFontResolver()
float
getFontSize2D(FontSpecification font)
FSFontMetrics
getFSFontMetrics(FSFont font)
int
getInitialPageNo()
float
getMmPerDot()
OutputDevice
getOutputDevice()
PageBox
getPage()
int
getPageCount()
int
getPageNo()
Layer
getRootLayer()
int
getShadowPageNumber()
TextRenderer
getTextRenderer()
UserAgentCallback
getUac()
java.awt.Rectangle
getViewportRectangle()
Get the viewport rect, for painting the body or html tag background.float
getXHeight(FontSpecification parentFont)
boolean
isFastRenderer()
boolean
isInFloatBottom()
Returns true if we are laying out the footnote area rather than general content.boolean
isInPageMargins()
boolean
isInteractive()
boolean
isPaged()
Returns true if the currently set media type is paged.boolean
isPrint()
void
setBaseURL(java.lang.String url)
void
setBidiReorderer(BidiReorderer bidi)
void
setFastRenderer(boolean isFast)
void
setFontContext(FontContext fontContext)
void
setInitialPageNo(int initialPageNo)
void
setInPageMargins(boolean inMargin)
void
setIsInFloatBottom(boolean inFloatBottom)
void
setOutputDevice(OutputDevice outputDevice)
void
setPage(int pageNo, PageBox page)
void
setPageCount(int pageCount)
void
setRootLayer(Layer rootLayer)
void
setShadowPageNumber(int shadow)
-
-
-
Field Detail
-
sharedContext
protected final SharedContext sharedContext
-
outputDevice
private OutputDevice outputDevice
-
fontContext
private FontContext fontContext
-
pageCount
private int pageCount
-
pageNo
private int pageNo
-
page
private PageBox page
-
shadowPageNumber
private int shadowPageNumber
-
rootLayer
private Layer rootLayer
-
initialPageNo
private int initialPageNo
-
isFastRenderer
private boolean isFastRenderer
-
inPageMargins
private boolean inPageMargins
-
_isInFloatBottom
private boolean _isInFloatBottom
-
_bidi
private BidiReorderer _bidi
-
-
Constructor Detail
-
RenderingContext
public RenderingContext(SharedContext sharedContext)
needs a new instance every run
-
-
Method Detail
-
isFastRenderer
public boolean isFastRenderer()
-
setFastRenderer
public void setFastRenderer(boolean isFast)
-
setBaseURL
public void setBaseURL(java.lang.String url)
-
getUac
public UserAgentCallback getUac()
-
getBaseURL
public java.lang.String getBaseURL()
-
getDPI
public float getDPI()
-
getMmPerDot
public float getMmPerDot()
- Specified by:
getMmPerDot
in interfaceCssContext
-
getDotsPerPixel
public int getDotsPerPixel()
- Specified by:
getDotsPerPixel
in interfaceCssContext
-
getFontSize2D
public float getFontSize2D(FontSpecification font)
- Specified by:
getFontSize2D
in interfaceCssContext
-
getXHeight
public float getXHeight(FontSpecification parentFont)
- Specified by:
getXHeight
in interfaceCssContext
-
getTextRenderer
public TextRenderer getTextRenderer()
- Specified by:
getTextRenderer
in interfaceCssContext
-
setBidiReorderer
public void setBidiReorderer(BidiReorderer bidi)
-
getBidiReorderer
public BidiReorderer getBidiReorderer()
-
isPaged
public boolean isPaged()
Returns true if the currently set media type is paged. Currently returns true only for print , projection , and embossed , handheld , and tv . See the media section of the CSS 2.1 spec for more information on media types.- Returns:
- The paged value
-
getFontResolver
public FontResolver getFontResolver()
-
getFont
public FSFont getFont(FontSpecification font)
- Specified by:
getFont
in interfaceCssContext
-
getCanvas
public FSCanvas getCanvas()
-
getFixedRectangle
public java.awt.Rectangle getFixedRectangle(boolean excludeFloatBottomArea)
Get the document (for non-paged docs) or page rect where fixed position boxes should be layed out. Generally we want to setexcludeFloatBottomArea
true so fixed content doesn't sit above footnotes.
-
getViewportRectangle
public java.awt.Rectangle getViewportRectangle()
Get the viewport rect, for painting the body or html tag background.
-
debugDrawBoxes
public boolean debugDrawBoxes()
-
debugDrawLineBoxes
public boolean debugDrawLineBoxes()
-
debugDrawInlineBoxes
public boolean debugDrawInlineBoxes()
-
debugDrawFontMetrics
public boolean debugDrawFontMetrics()
-
isInteractive
public boolean isInteractive()
-
isPrint
public boolean isPrint()
-
getOutputDevice
public OutputDevice getOutputDevice()
-
setOutputDevice
public void setOutputDevice(OutputDevice outputDevice)
-
getFontContext
public FontContext getFontContext()
- Specified by:
getFontContext
in interfaceCssContext
-
setFontContext
public void setFontContext(FontContext fontContext)
-
setPage
public void setPage(int pageNo, PageBox page)
-
getPageCount
public int getPageCount()
-
setPageCount
public void setPageCount(int pageCount)
-
getPage
public PageBox getPage()
-
getPageNo
public int getPageNo()
-
getCss
public StyleReference getCss()
- Specified by:
getCss
in interfaceCssContext
-
getFSFontMetrics
public FSFontMetrics getFSFontMetrics(FSFont font)
- Specified by:
getFSFontMetrics
in interfaceCssContext
-
getRootLayer
public Layer getRootLayer()
-
setRootLayer
public void setRootLayer(Layer rootLayer)
-
getInitialPageNo
public int getInitialPageNo()
-
setInitialPageNo
public void setInitialPageNo(int initialPageNo)
-
getBoxById
public Box getBoxById(java.lang.String id)
-
setShadowPageNumber
public void setShadowPageNumber(int shadow)
-
getShadowPageNumber
public int getShadowPageNumber()
- Returns:
- overflow page number or -1 if this is not an overflow page.
-
setInPageMargins
public void setInPageMargins(boolean inMargin)
-
isInPageMargins
public boolean isInPageMargins()
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
setIsInFloatBottom
public void setIsInFloatBottom(boolean inFloatBottom)
-
isInFloatBottom
public boolean isInFloatBottom()
Returns true if we are laying out the footnote area rather than general content.- Specified by:
isInFloatBottom
in interfaceCssContext
-
-