[Tex/LaTex] Add text field in which 10 lines of text can be written electronically

formshyperrefquestionnaire

How do I add a text field like the one outlined in red in the image below? I have spent days finding a solution. It must be possible to fill in the text field electronically. Ideas for improving layout are also appreciated. Thanks in advance!

enter image description here

Code below:

\documentclass[pagesize=pdftex,DIV=16]{scrartcl}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage[danish]{babel}
\usepackage[utf8]{inputenc}
\newsavebox\TBox
\begin{document}
    \begin{Form}
        \section*{Application for xxx}
        \sbox\TBox{Name: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{
         Name: }\\[1ex]
        \sbox\TBox{Organization: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{
         Organization: }\\[1ex]
        \sbox\TBox{Address: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{
         Address: }\\[1ex]
        \sbox\TBox{Postal code: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Postal code: }
        \sbox\TBox{Abcd:. }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Abcd: }\\[1ex]
        \sbox\TBox{E-mail: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{E-mail: }
    \end{Form} \\\\
    \begin{Form}
\begin{tabular}{l}
\hspace*{-0.73cm} Question \hspace*{1cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Another question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Another question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Another question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
\hspace*{-0.73cm} Last question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[0.2cm]
\end{tabular}
\end{Form}\\
Motivation:
\end{document}

Best Answer

This seems to work. BTW, the manual says that only one Form is allowed. Also, you don't need all those negative \hspace if you don't add a gap to begin with.

It should be noted that the default character size (charsize) is 10pt and the effective \baselineskip for forms is about 11.5pt.

\documentclass[pagesize=pdftex,DIV=16]{scrartcl}
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage[danish]{babel}
\usepackage[utf8]{inputenc}
\newsavebox\TBox
\begin{document}
    \begin{Form}
        \section*{Application for xxx}
        \sbox\TBox{Name: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox,height=\baselineskip]%
         {Name: \strut}\\[1ex]
        \sbox\TBox{Organization: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]%
         {Organization: \strut}\\[1ex]
        \sbox\TBox{Address: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]%
         {Address: \strut}\\[1ex]
        \sbox\TBox{Postal code: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Postal code: \strut}
        \sbox\TBox{ Abcd: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr0.5\linewidth-\wd\TBox]{Abcd: \strut}\\[1ex]
        \sbox\TBox{E-mail: }%
        \TextField[backgroundcolor=gray!20,borderwidth=0,width=\dimexpr\linewidth-\wd\TBox]{E-mail: \strut}

\bigskip
\noindent\begin{tabular}{@{}l}
Question \hspace*{1cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Another question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Another question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Another question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[-0.2cm]
Last question \hspace*{0.5cm}
    \CheckBox[name=first=true,width=1em]{Ja} \hspace*{0.2cm}
    \CheckBox[name=second,width=1em]{Nej} \\\\[0.2cm]
\end{tabular}

\sbox\TBox{Motivation: }%
\noindent\TextField[multiline,backgroundcolor=gray!20,borderwidth=0,width=\dimexpr \linewidth-\wd\TBox,height=115pt]%
  {\strut\raisebox{104.5pt}{Motivation:} }
\end{Form}
\end{document}