[Tex/LaTex] Fillable PDF Form – text field inside a table

hyperrefpdfxetex

I am trying to create a fillable pdf form. I am using the hyperref package.

I am able to create fillable text fields, however, when I want to create a fillable text field inside a table, it does not work. The code is attached.

Please let me know how this can be solved.

Edit: It works fine with pdfLatex, however, I need to get it working with XeLateX

\documentclass[a4paper,8pt]{article}
\usepackage[legalpaper,left=4pt,right=14pt,top=13pt,bottom=14pt]{geometry}
\usepackage{hyperref}
\usepackage{multirow}
\usepackage{setspace} 

\begin{document}
%set font type
\fontfamily{lmss}\selectfont
\singlespacing

%begin form environment
\begin{Form}[action=mailto:forms@stackexchange.invalid?subject={The submitted form},method=post]


\begin{center}
\noindent\TextField[name=compay,width=5cm]{}\\[0mm]
\LARGE{Appraisal Report}
\end{center}

\begin{flushright}
    \TextField[name=file_no,width=5cm]{File No. } \\[0mm]
\end{flushright}

\begin{table}[h]
    \centering
    \caption{My caption}
    \label{my-label}
    \begin{tabular}{lllll}
        Test Table & \multicolumn{4}{l}{} \\
    a   &   a  &  f   & f    &   f \\
    d   &  s   &  \TextField[name=file_no,width=5cm]{File No: }   & a s   &    s  \\
        &     &     &     &   
    \end{tabular}
\end{table}

\end{Form}

\end{document}

Best Answer

I can confirm that it does not work in XeLaTex

It will work in a p column. See MWE below. Likewise in your MWE

Curiously it is not simply a case of too little space in l column - even if column is forced easily wide enough.

\documentclass[a4paper,8pt]{article}
\usepackage[legalpaper,left=4pt,right=14pt,top=13pt,bottom=14pt]{geometry}
\usepackage{hyperref}
\fontfamily{lmss}\selectfont

\begin{document}
\begin{Form}[action=mailto:forms@stackexchange.invalid?subject={The submitted form},method=post]

%this
With l column

\begin{tabular}{l}
\TextField[name=file_no,width=5cm]{File No: }\\
\end{tabular}

%versus this
With p column

\begin{tabular}{@{}p{6cm}p{5cm}@{}}
\rule{0pt}{4ex}\TextField[name=file_no,width=3cm]{File No: }&Some text\\
\rule{0pt}{4ex}\TextField[name=file_no,width=3cm]{File No: }&Some text\\
\rule{0pt}{4ex}\TextField[name=file_no,width=3cm]{File No: }&Some text\\
\rule{0pt}{4ex}\TextField[name=file_no,width=3cm]{File No: }&Some text\\
\end{tabular}

\end{Form}

\end{document}
Related Question