Hyperref – Converting Textfield Borders into Lines in LaTeX Forms

formshyperrefpdftex

How could I transfer a textfield border into a line to write on in case of someone files the printed version of the pdf form?

I'm working with underline and raiseboxes at the moment, but that crushes my layout at some points. So it would be great to use the border of \TextField to create a line.

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{Form}
\underline{\raisebox{0.3em}{\TextField[width=7.cm,bordercolor=]{\textbf{Description:}}
\end{Form}
\end{document}

Without the \raisebox, the line is overlapped by the invisible \textfield[bordercolor=]. At most places, this works fince, although underlining the label looks weird. But when formating multiple of those in minipages etc., the layout gets out of place, because of the different line heights. Minimising the TextField does not work either. It takes either the full height or becomes a thin line.

So I'd like to alternate the border itself, to stay within normal line height and create a \textfield with just a line on the bottom in print version.

Best Answer

To use a line as border of a TextField, you can use the option borderstyle=U. You might also want to change the bordercolor to black:

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{Form}
  \TextField[width=7.cm,borderstyle=U,bordercolor={0 0 0}]{\textbf{Description:}}
\end{Form}
\end{document}

This will change the border not only when printing the document, but also when it is displayed on screen. This is hard to avoid and in most cases a good thing. I always prefer for documents to look on screen as similar as possible as the printed version.

Related Question