1

I need to get fillable text fields inside tabular environment and since I use other language scripts other than English I need to compile my document using XeTeX engine. The nearest post to this question I have found here, but this has been more than 3 years and 7 months now. The post confirmed the case that it does not work with XeTeX engine, I look forward to any update on this issue:

Below is my MWE:

MWE

\documentclass[a4]{scrartcl}
\usepackage[left=1cm,right=1cm,top=0.5cm,bottom=1cm]{geometry} %showframe
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}
\begin{Form}

\begin{tabular}{ccccccc}
  \textbf{No} & \textbf{Name} & \textbf{Code} & \textbf{Request Date} & \textbf{Source} & \textbf{Issue Date} & \textbf{Notes} \\
  \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.05\textwidth,default=1]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.2\textwidth]{} & \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.05\textwidth]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.1\textwidth]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.1\textwidth]{} &
                                                                                                                \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.1\textwidth]{} & \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.2\textwidth]{} \\

    \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.05\textwidth,default=2]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.2\textwidth]{} & \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.05\textwidth]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.1\textwidth]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.1\textwidth]{} &
\TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.1\textwidth]{} & \TextField[backgroundcolor=white,borderwidth=1,bordercolor=gray!30,height=20pt,width=0.2\textwidth]{} \\
\end{tabular}  

\end{Form}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-engine: xetex
%%% TeX-master: t
%%% End:

Output

enter image description here

  • Sorry but do you really think that an example trying to create about 100 (or more) textfields can be called "minimal"? – Ulrike Fischer Jan 4 at 17:53
  • some redundant code is removed. – doctorate Jan 4 at 18:04
2

Textfields musst have a (unique) name, either throught the label argument or with the name key. With it it works fine for me with xelatex on texlive 2018:

\documentclass{scrartcl}
\usepackage[left=1cm,right=1cm,top=0.5cm,bottom=1cm]{geometry} %showframe
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{hyperref}

\begin{document}
\begin{Form}

\begin{tabular}{c}
  \textbf{No}\\ 
  \TextField[name=r1,backgroundcolor=white,borderwidth=1,
             bordercolor=gray!30,height=20pt,width=0.2\textwidth]{} \\
  \TextField[name=r2,backgroundcolor=white,borderwidth=1,
             bordercolor=gray!30,height=20pt,width=0.2\textwidth]{} \\

\end{tabular}

\end{Form}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.