Class PdfUtil

java.lang.Object
org.vandeseer.easytable.util.PdfUtil

public final class PdfUtil extends Object
Provides some helping functions.
  • Field Details

  • 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 - Text
      font - Font of Text
      fontSize - 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 - Font
      fontSize - 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 - Text
      font - Used font
      fontSize - Used fontSize
      maxWidth - Maximal width of resulting text-lines
      Returns:
      A list of lines, where all are smaller than maxWidth