CssContext

Overview

CssContext is a class in Aspose.Pdf FOSS for Java.

Cascading style context for HTML-to-PDF conversion.

Properties

NameTypeAccessDescription
fontSizedoubleReadReturns the font size in points.
fontFamilyStringReadReturns the CSS font-family name.
boldbooleanReadReturns whether the text is bold.
italicbooleanReadReturns whether the text is italic.
underlinebooleanReadReturns whether the text is underlined.
colorColorReadReturns the text (foreground) color.
backgroundColorColorReadReturns the background color, or {@code null} if none is set.
textAlignStringReadReturns the text alignment (left, center, right, justify).
lineHeightdoubleReadReturns the line height in points.
marginTopdoubleReadReturns the top margin in points.
marginBottomdoubleReadReturns the bottom margin in points.
marginLeftdoubleReadReturns the left margin in points.
marginRightdoubleReadReturns the right margin in points.
widthdoubleReadReturns the explicit width in points, or 0 if not set.
heightdoubleReadReturns the explicit height in points, or 0 if not set.

Methods

SignatureDescription
inherit()CssContextCreates a new child context that inherits text properties from this context.
toPdfFontName()StringMaps the current font-family, bold, and italic settings to a PDF standard
(Type 1) font name.
getFontSize()doubleReturns the font size in points.
setFontSize(fontSize: double)Sets the font size in points.
getFontFamily()StringReturns the CSS font-family name.
setFontFamily(fontFamily: String)Sets the CSS font-family name.
isBold()booleanReturns whether the text is bold.
setBold(bold: boolean)Sets the bold flag.
isItalic()booleanReturns whether the text is italic.
setItalic(italic: boolean)Sets the italic flag.
isUnderline()booleanReturns whether the text is underlined.
setUnderline(underline: boolean)Sets the underline flag.
getColor()ColorReturns the text (foreground) color.
setColor(color: Color)Sets the text (foreground) color.
getBackgroundColor()ColorReturns the background color, or {@code null} if none is set.
setBackgroundColor(backgroundColor: Color)Sets the background color.
getTextAlign()StringReturns the text alignment (left, center, right, justify).
setTextAlign(textAlign: String)Sets the text alignment.
getLineHeight()doubleReturns the line height in points.
setLineHeight(lineHeight: double)Sets the line height in points.
getMarginTop()doubleReturns the top margin in points.
setMarginTop(marginTop: double)Sets the top margin in points.
getMarginBottom()doubleReturns the bottom margin in points.
setMarginBottom(marginBottom: double)Sets the bottom margin in points.
getMarginLeft()doubleReturns the left margin in points.
setMarginLeft(marginLeft: double)Sets the left margin in points.
getMarginRight()doubleReturns the right margin in points.
setMarginRight(marginRight: double)Sets the right margin in points.
getWidth()doubleReturns the explicit width in points, or 0 if not set.
setWidth(width: double)Sets the explicit width in points.
getHeight()doubleReturns the explicit height in points, or 0 if not set.
setHeight(height: double)Sets the explicit height in points.

See Also