programmatically finding PDF form field size

I am using this example to fill a PDF form. How do i determine the maximum allowed character limit for each field ?

http://www.codeproject.com/KB/cs/FillFormFieldsOfPDFs.aspx
byte1Asked:
Who is Participating?
 
Meir RivkinFull stack Software EngineerCommented:
so the rectangle to check is:
RectangleF rf = new RectangleF(dims[1], dims[4], dims[3] - dims[1], dims[4] - dims[2]);

0
 
Meir RivkinFull stack Software EngineerCommented:
its a bit tricky but doable, u can use AcroFields.GetFiledPositions to get field dimentions and then use Graphics.MeasureString to check how many characters can be fit into the field rectangle.

i.e
float[] dims = pdfFormFields.GetFieldPositions("f1_01(0)");
disregard the first array entry (its the page value),

the field dimensions are the following:
dims [1]= Left;
dims [2] = Bottom;
dims [3] = Right;
dims [4] = Top;



0
 
byte1Author Commented:
I use asp.net, Graphics.MeasureString was not available
0
 
byte1Author Commented:
Could you please give me an example on how i can use MeasureString to determine the size. Thanks.
0
 
Meir RivkinFull stack Software EngineerCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.