# In LaTeX, how to have a TextField with limited number of characters

I am using LaTeX to make a fillable PDF file.

I use the \TextField command in the hyperref package to get the fillable field in the PDF file.

In some places, I want to have a field which has a limited number of characters for input, e.g. the phone number or card number.

How could I realize this effect? I looked up the texdoc for hyperref package but failed to find any information for this effect.

Would anyone please give me some idea?

-

## migrated from stackoverflow.comFeb 26 '13 at 21:13

This question came from our site for professional and enthusiast programmers.

hyperref provides the key-value maxlen that limits the number of characters in a text field:

\documentclass{article}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\begin{document}
\begin{Form}
\TextField[name=phonenumber,value=xxxyyyzzzz,maxlen=10]{Phone:}
\end{Form}
\end{document}


This is discussed in the hyperref manual under section 6.2 Forms optional parameters.

-
Thank you very much, Werner. Your answer has definitely solved my problem. I am sorry for my inattention when reading the manual, though I had gone through the option arguments in §6.2. –  Hanzhi Diao Feb 27 '13 at 8:28
@HanzhiDiao: hyperref has many options that are not readily documented. If this answered your question, consider accepting it as such. See How do you accept an answer? –  Werner Feb 27 '13 at 8:31
I have made the accepting. Sorry for the delayed operation. It is my first post here. –  Hanzhi Diao Feb 27 '13 at 10:03