[Tex/LaTex] How to raise or lower text fields in pdf forms

formspdfraise

I've been having a misalignment issue between text fields generated with hyperref and the corresponding straight lines below them. The attached image illustrates the problem.

Textfields are misaligned with the lines below

The objective is clear. I would like to lower the text fields so that each text field lies directly above the corresponding straight line. My code is as follows:

\documentclass{article}

\usepackage{hyperref}

\begin{document}

\begin{flushleft}
    \begin{Form}
\renewcommand{\baselinestretch}{1.0}
\fontsize{12}{24}\selectfont
\hspace*{2cm} \TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\
\hspace*{2cm} \rule[-2.5ex]{11.4cm}{0.5pt} \\
\hspace*{2cm} advisor, \hspace{2cm} Date\\
\hspace*{2cm} \TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\
\hspace*{2cm} \rule[-2.5ex]{11.4cm}{0.5pt} \\
\hspace*{2cm} memberA \\
\hspace*{2cm} \TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\
\hspace*{2cm} \rule[-2.5ex]{11.4cm}{0.5pt} \\
\hspace*{2cm} memberB \\
\hspace*{2cm} \TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\
\hspace*{2cm} \rule[-2.5ex]{11.4cm}{0.5pt} \\
\hspace*{2cm} memberC \\
\hspace*{2cm} \TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\
\hspace*{2cm} \rule[-2.5ex]{11.4cm}{0.5pt} \\
\hspace*{2cm} memberD \\
    \end{Form}
\end{flushleft}


\end{document}

There is always the option of raising the lines but I will have to raise the signature titles (e.g. advisor, memberA) as well. I would prefer to lower the text fields if possible, since I can always create them by hand using Acrobat if necessary.

Any help will be appreciated.

Best Answer

I would use a tabular along with booktabs:

\documentclass[12pt]{article}
\usepackage{booktabs}
\usepackage{hyperref}

\begin{document}
\begin{Form}
\begin{tabular}{@{}p{11.5cm}@{}}
\TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\\midrule[0.5pt]
advisor, \hspace{2cm} Date\\[2.5ex]
\TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\\midrule[0.5pt]
memberA\\[2.5ex]
\TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\\midrule[0.5pt]
 memberB\\[2.5ex]
\TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\\midrule[0.5pt]
memberC\\[2.5ex]
\TextField[name=First and Last Name, width=8cm, borderwidth=1]{}\\\midrule[0.5pt]
memberD
\end{tabular}
    \end{Form}


\end{document}

enter image description here

Related Question