Class StyleAttrCSSResolver
java.lang.Object
com.itextpdf.tool.xml.css.StyleAttrCSSResolver
- All Implemented Interfaces:
CSSResolver
Resolves CSS properties.
- Author:
- redlab_b
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a newStyleAttrCSSResolverwith default settings.StyleAttrCSSResolver(CssFiles cssFiles) Construct a new StyleAttrCSSResolver with the givenCssFilesand theDefaultCssInheritanceRules.StyleAttrCSSResolver(CssFiles cssFiles, CssUtils utils) Construct a new StyleAttrCSSResolver with the givenCssFilesandCssUtilsand theDefaultCssInheritanceRules.StyleAttrCSSResolver(CssFiles cssFiles, FileRetrieve r) StyleAttrCSSResolver(CssInheritanceRules rules, CssFiles cssFiles, CssUtils utils) StyleAttrCSSResolver(CssInheritanceRules rules, CssFiles cssFiles, CssUtils utils, FileRetrieve fileRetrieve) -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a file to the CssFiles Collection.voidAdd a piece of CSS code.voidAdd a piece of CSS code.voidaddCssFile(String href, boolean isPersistent) Add a file to the CssFiles Collection.clear()voidresolveStyles(Tag t) Also taking into account the CSS properties of any parent tag in the given tag.voidsetCssInheritance(CssInheritanceRules cssInheritanceRules) By setting an implementation ofCssInheritanceRulesa developer can set rules on what css selectors are inherited from parent tags.voidvoidsetFileRetrieve(FileRetrieve retrieve) TheFileRetrieveimplementation to use inaddCss(String, boolean).
-
Field Details
-
STYLE
- See Also:
-
-
Constructor Details
-
StyleAttrCSSResolver
public StyleAttrCSSResolver()Construct a newStyleAttrCSSResolverwith default settings. -
StyleAttrCSSResolver
Construct a new StyleAttrCSSResolver with the givenCssFilesand theDefaultCssInheritanceRules.- Parameters:
cssFiles- aCssFilesimplementation.
-
StyleAttrCSSResolver
-
StyleAttrCSSResolver
- Parameters:
rules- theCssInheritanceRulesto use.cssFiles- aCssFilesimplementation.utils- the CssUtils to use.
-
StyleAttrCSSResolver
public StyleAttrCSSResolver(CssInheritanceRules rules, CssFiles cssFiles, CssUtils utils, FileRetrieve fileRetrieve) - Parameters:
rules- theCssInheritanceRulesto use.cssFiles- aCssFilesimplementation.utils- the CssUtils to use.fileRetrieve- theFileRetrieveimplementation
-
StyleAttrCSSResolver
- Parameters:
cssFiles- theCssFileimplementationr- theFileRetrieveimplementation
-
-
Method Details
-
resolveStyles
Also taking into account the CSS properties of any parent tag in the given tag.- Specified by:
resolveStylesin interfaceCSSResolver- Parameters:
t- the tag.- See Also:
-
setCssInheritance
By setting an implementation ofCssInheritanceRulesa developer can set rules on what css selectors are inherited from parent tags.- Parameters:
cssInheritanceRules- the inherit to set
-
addCss
public void addCss(String content, String charSet, boolean isPersistent) throws CssResolverException Description copied from interface:CSSResolverAdd a piece of CSS code.- Specified by:
addCssin interfaceCSSResolver- Parameters:
content- the CSScharSet- a charsetisPersistent- true if the added css should not be deleted on a call to clear- Throws:
CssResolverException- thrown if something goes wrong
-
addCssFile
Add a file to the CssFiles Collection.- Specified by:
addCssFilein interfaceCSSResolver- Parameters:
href- the path, if it starts with http we try to retrieve the file from the net, if not we try a normal file operation.isPersistent- true if the added css should not be deleted on a call to clear- Throws:
CssResolverException- thrown if something goes wrong
-
addCss
Add a file to the CssFiles Collection.- Specified by:
addCssin interfaceCSSResolver- Parameters:
file- the CssFile to add.
-
addCss
Description copied from interface:CSSResolverAdd a piece of CSS code.- Specified by:
addCssin interfaceCSSResolver- Parameters:
content- the content to parse to cssisPersistent- true if the added css should not be deleted on a call to clear- Throws:
CssResolverException- thrown if something goes wrong
-
setCssInheritanceRules
- Parameters:
inherit- the inherit to set
-
setFileRetrieve
TheFileRetrieveimplementation to use inaddCss(String, boolean).- Specified by:
setFileRetrievein interfaceCSSResolver- Parameters:
retrieve- the retrieve to set
-
clear
- Specified by:
clearin interfaceCSSResolver- Returns:
- an instance of this resolver
- Throws:
CssResolverException- thrown if something goes wrong
-