Is there a way to detect text overflow in a multiline form field? Ideally, I would like to be able to add the text as an additional page if it will not fit in the field.
Hi Randy,
No, I am filling form fields and want to know if the value I’m adding is going to overflow (i.e., not be entirely visible) when added to a multi line text box.
Hi Randy,
The FieldLimit is just the maximum number of characters allowed in a field, which has nothing to do with whether or not the text will overflow. For example, a textbox that is approximately four lines tall will overflow if the text contains more than four line breaks. I want to know when that happens so I can do something about it.
Hi Randy,
Thanks for sharing the details.
The Form.GetFieldLimit(…) method provides the feature to get length of filed inside PDF document and in case the amount of text being added inside the form field is greater than field length, the data/content will overflow from the field. However as per my understanding, you need to determine if the field supports multi-line text or not and in case we have set the multi-line as false, the text should not flow out of field. If so is the case, then you may consider using following code lines to determine if the field is multi-line or not.
[C#]
// Getting maximum field limit using DOM
Document doc = new Document(dataDir + "FieldLimit.pdf");
// determine if the field is multi-line or not
Console.WriteLine("Limit: " + (doc.Form["textbox1"] as TextBoxField).Multiline);