Link to home
Start Free TrialLog in
Avatar of byte1
byte1Flag for United States of America

asked on

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
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

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;



ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of byte1

ASKER

I use asp.net, Graphics.MeasureString was not available
Avatar of byte1

ASKER

Could you please give me an example on how i can use MeasureString to determine the size. Thanks.