In iText, what is the minimum height of a
PdfPCell for which a given size of font text is visible? I mean is there any ratio between
PdfPCell and font size? I am making a PDF with pages of size A3, A4 and A5. I need to know the relation between
Font size and
PdfPCell minimum height, so that the text will be visible.
In iText 7 we can work with cells in composite mode only, so we can not work with leading and Ascender / Descender. These values depend on the elements which you add into the cell. But still you can set the padding:
- padding is the extra space inside the borders of the cell. It's similar to the concept with the same name in HTML. You can change the padding of a cell with the
So, if you want the cell to have a minimal size, you need to set the padding to 0, the leading to match the size of the font, and tell iText to use the ascender and descender value.
DISCLAIMER: in the past, we've received reports from customers that showed us that not all fonts contain the correct ascender and descender information. This needs to be fixed at the font level.
Click this link if you want to see how to answer this question in iText 5.