Check if Widget big enough to hold the value

Can we check if widget big enough to hold the value without overflowing? For example, we fill text fields and increase it's size when text do not fits

Hi John,


Thanks for your inquriy. I am afraid currently we can not check dynamically that whether field will holds the value or overflow. I have logged a ticket PDFJAVA-36090 for further investigation and rectification. We will keep you updated about the issue resolution progress.

However meanwhile you may either set FitIntoRectangle property of TextBoxField to true to fit value into the TextBoxField or can set Multiline value to true to support multi-line text input.

We are sorry for the inconvenience.

Best Regards,

Hi John,

Thanks for your patience.

We have further investigated the earlier logged enhancement PDFJAVA-36090 and in order to accomplish this requirement, you may consider using following code snippet which helps to measure the text width for any font and text size.

[Java]

Font font = FontRepository.findFont("ComicSansMS");
double actual = font.measureString("NEW_FIELD_TEXT", 10);
System.out.println("Actual text width is: " + actual);