The method PdfUtil.getStringWidth() should calculate the length of every line, not just the line that contains the longest string.
The width of the individual letters can be very different so a string with less characters can be wider than a string with more characters. For instance, a single w is wider then three times i.
The method PdfUtil.getStringWidth() should calculate the length of every line, not just the line that contains the longest string. The width of the individual letters can be very different so a string with less characters can be wider than a string with more characters. For instance, a single w is wider then three times i.
Example:
result: w1 = 6.66 w2 = 21.66 both should return 21.66