public class CssUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
extractUrl(String url)
Parses url("file.jpg") to file.jpg .
|
static boolean |
isColorProperty(String value) |
static boolean |
isMetricValue(String value)
Checks whether a string contains an allowed metric unit in HTML/CSS; px, in, cm, mm, pc or pt.
|
static boolean |
isNumericValue(String value)
Checks whether a string matches a numeric value (e.g.
|
static boolean |
isRelativeValue(String value)
Checks whether a string contains an allowed value relative to previously set value.
|
static boolean |
isRemValue(String value)
Checks whether a string contains an allowed value relative to previously set root value.
|
static String |
normalizeCssProperty(String str) |
static float |
parseAbsoluteLength(String length) |
static float |
parseAbsoluteLength(String length, String defaultMetric)
Parses a length with an allowed metric unit (px, pt, in, cm, mm, pc, q) or numeric value (e.g.
|
static int[] |
parseAspectRatio(String str) |
static Float |
parseFloat(String str) |
static Integer |
parseInteger(String str) |
static com.itextpdf.layout.property.UnitValue |
parseLengthValueToPt(String value, float emValue, float remValue) |
static float |
parseRelativeValue(String relativeValue, float baseValue)
Parses an relative value based on the base value that was given, in the metric unit of the base value.
|
static float |
parseResolution(String resolutionStr)
Returns value in dpi (currently)
|
static float[] |
parseRgbaColor(String colorValue) |
static String |
removeDoubleSpacesAndTrim(String str) |
public static int[] parseAspectRatio(String str)
public static float parseAbsoluteLength(String length, String defaultMetric)
length
- the string containing the length.
defaultMetric
- the string containing the metric if it is possible that the length string does not contain one. If null the length is considered to be in px as is default in HTML/CSS.
public static float parseAbsoluteLength(String length)
public static float parseRelativeValue(String relativeValue, float baseValue)
relativeValue
- in %, em or ex.
baseValue
- the value the returned float is based on.
public static com.itextpdf.layout.property.UnitValue parseLengthValueToPt(String value, float emValue, float remValue)
public static float parseResolution(String resolutionStr)
resolutionStr
-
public static boolean isColorProperty(String value)
public static float[] parseRgbaColor(String colorValue)
public static boolean isMetricValue(String value)
value
- the string that needs to be checked.
public static boolean isRelativeValue(String value)
value
- the string that needs to be checked.
public static boolean isRemValue(String value)
value
- the string that needs to be checked.
public static boolean isNumericValue(String value)
value
- the string that needs to be checked.
Copyright © 1998–2019 iText Group NV. All rights reserved.