How do I limit how many big a number can be entered into a field?

Question:

I want to limit the number that can be entered to something like the following. “1234.56”

That is, 4 digits, plus two decimal places.

In Acrobat I set the “Format Category” to “Number”, “Decimal Places” to “2”, and “Separator Style” to “1,234.56”.

But there is still no limit to number of characters.

Answer:

The PDF standard does not provide this fine grained of control, but it does provide close support.

First, you can use Field.SetMaxLen to limit the number of characters that can be entered. Though any character counts, so “-”, “,” and “.” would also count.

This matches the “Character Limit” value in Acrobat.