Package org.vandeseer.easytable.util
Class PdfUtil
java.lang.Object
org.vandeseer.easytable.util.PdfUtil
Provides some helping functions.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic floatgetFontHeight(org.apache.pdfbox.pdmodel.font.PDFont font, int fontSize) Computes the height of a font.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 Details
-
NEW_LINE_REGEX
- See Also:
-
-
Constructor Details
-
PdfUtil
public PdfUtil()
-
-
Method Details
-
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
-