Package org.vandeseer.easytable.util
Class PdfUtil
- java.lang.Object
-
- org.vandeseer.easytable.util.PdfUtil
-
public final class PdfUtil extends Object
Provides some helping functions.
-
-
Field Summary
Fields Modifier and Type Field Description static StringNEW_LINE_REGEX
-
Constructor Summary
Constructors Constructor Description PdfUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static floatgetFontHeight(org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize)Computes the height of a font.static List<String>getOptimalTextBreakLines(String text, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize, float maxWidth)Split a text into multiple lines to prevent a text-overflow.static floatgetStringWidth(String text, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize)Computes the width of a String (in points).
-
-
-
Field Detail
-
NEW_LINE_REGEX
public static final String NEW_LINE_REGEX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getStringWidth
public static float getStringWidth(String text, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize)
Computes the width of a String (in points).- Parameters:
text- Textfont- Font of TextfontSize- FontSize of String- Returns:
- Width (in points)
-
getFontHeight
public static float getFontHeight(org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize)Computes the height of a font.- Parameters:
font- FontfontSize- FontSize- Returns:
- Height of font
-
getOptimalTextBreakLines
public static List<String> getOptimalTextBreakLines(String text, org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize, float maxWidth)
Split a text into multiple lines to prevent a text-overflow.- Parameters:
text- Textfont- Used fontfontSize- Used fontSizemaxWidth- Maximal width of resulting text-lines- Returns:
- A list of lines, where all are smaller than maxWidth
-
-