I’m starting an automation where the main goal is to fill some fields of a pdf. The task is mostly simple, but i’m having some difficulties in one specific field of the pdf.
The address field of the PDF is limited in terms of pixels, and some strings doesn’t fit there. In that cases, I’ve to throw a business exception.
The question here is: there is an easy way to know the exact limit of that field? And convert the string previously to pixels to know how many pixels it will correspond?
are you sure the field is limited by pixels and not by number of characters?
You could find these out by trial and error or by examining the pdf file with pdf software. Form field properties could look something like this:
Counting characters in strings is pretty easy, just use String.Length
Thank you for your answer.
Count the number of characters is very easy and that’s not the problem here. The field isn’t constant in terms of characters. For example: It’s possible to write 36 “i” characters but only fits 30 “a” characters. So I found that the field is limited by the number of pixels and not by the number of characters.
Don’t know how to get the limit of the field. My first guess is still the best - either trial and error or trying to inspect the form with the right tool…
The field is not limited by the number of pixels. I can insert 470 pixels of “A” and in the same field fits 308 pixels of “I”. Therefore, i can’t fulfill this requirement because the limit of pixels of the field isn’t constant.