/** * Calculates what the height of the first line should be so that the content will be flush with * the top. For text, this is the height of the ascender. For an image, it is the actual height of * the image. * * @return the real height of the first line */ private float firstLineRealHeight() { float firstLineRealHeight = 0f; if (firstLine != null) { PdfChunk chunk = firstLine.getChunk(0); if (chunk != null) { Image image = chunk.getImage(); if (image != null) { firstLineRealHeight = firstLine.getChunk(0).getImage().scaledHeight(); } else { firstLineRealHeight = useAscender ? firstLine.getAscender() : leading; } } } return firstLineRealHeight; }