TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com Feb 26 '13 at 21:13

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

up vote 8 down vote accepted

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

enter image description here

\usepackage{hyperref}% http://ctan.org/pkg/hyperref

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

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.