2

I want to create a pdf with several fillable form boxes but I can't do so with any free PDF software. I can do it in LaTeX but I can't seem to figure out how to get the text in the fillable form to scale its font size to fit. I found the code below and I can make the box whatever size I like, but any text I type inside the box remains a set size and doesn't scale to fit like other PDFs I've seen. I couldn't find anything about it in the hyperref documentation, is there any way to do this or am I SOL?


\usepackage{hyperref}

\begin{document} \begin{Form} \noindent \TextField[name=multilinetextbox, multiline=true, width=\linewidth,height=5in]{} \end{Form} \end{document}

Will Be
  • 21

3 Answers3

1

As far I got your query, you want something like this?

\usepackage{hyperref}

\begin{document} \begin{Form} \noindent \TextField[name=multilinetextbox, multiline=true, width=\linewidth,height=5in,charsize=30pt]{} \end{Form} \end{document}

Output:

enter image description here

I have just added a piece of option param: charsize=30pt. See the code.

mmr
  • 2,249
  • 5
  • 22
  • Not quite, if the text in this box gets too long it will add a scrollbar. I want the text's fontsize to scale down instead of adding a scrollbar. – Will Be Jun 08 '22 at 18:36
  • @Will Be I have never seen this in a pdf and I doubt, it is possible. – MaestroGlanz Jun 08 '22 at 19:18
0

I think that it is not possible. C. f. here and here. In addition, I presume that you have seen not a text field expansion, but rather a shrinking of the font size, if a scrollbar would be needed. At least this happened to me recently. But I do not know how to do it with hyperref.

0

you can set the charsize to 0pt. Then the font will adjust if you add more text. This is part of the pdf specififation:

A zero value for size means that the font shall be auto-sized

\documentclass[]{article}

\usepackage{hyperref}

\begin{document} \begin{Form} \noindent \TextField[name=multilinetextbox,multiline,charsize=0pt, width=\linewidth,height=1in]{} \end{Form} \end{document}

enter image description here

Ulrike Fischer
  • 327,261