我在尝试创建可填写的 PDF 表单时遇到了困难。
具体来说,我找不到实现两件事的方法:
• 顶部带有文本的单选按钮
• 可填写“最后评论”的空白字段
这是我做的:
\begin{Form}[action=mailto:[email protected]?subject=…
{The submitted form},encoding=html, method=post]
\begin{tabbing}
xxxxxxxxxx: \= \kill % This is needed for the right tab width
Field to identify the name: \> \TextField[name=name,width=5cm,charsize=8pt]
{\mbox{}} \\
Some text in which a question is posed: \> \\
\ChoiceMenu[combo, name=percorso, width=5cm, charsize=12pt, default=]{\mbox{}}
{Answer1, Answer2} \\
Sex: \>
\ChoiceMenu[radio,default=f,name=sex,charsize=14pt]{\mbox{}}{Male=m,Female=f}
\end{tabbing}
\CheckBox[name=highschool,charsize=12pt]{High School}
\CheckBox[name=college,charsize=12pt]{College}
\CheckBox[name=university,charsize=12pt]{University} \\
\Submit{Submit}
\Reset{Clear}
\hfill ~\\
\end{Form}
\end{document}
非常感谢所有帮助我的人!
再见!
答案1
要使单选按钮的文本位于顶部,请将它们放在表格中,第一行显示描述,第二行显示没有描述的按钮。
为了有一个可填写的空白字段用于评论,我想您会喜欢一个multiline=true
带有选项的大字段。
\documentclass{article}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{xcolor}
\usepackage{hyperref}
\begin{document}
\begin{Form}[action=mailto:[email protected]?subject={The submitted form},encoding=html, method=post]
\noindent\begin{tabular}{@{}m{4cm}@{}m{5.1cm}@{}}
Field to identify the name: &
% \makebox taken from https://tex.stackexchange.com/questions/79958/hyperref-textfield-inside-the-table-cell
\makebox{\TextField[name=name,width=5cm,charsize=8pt, height=.5cm]{}}\\
\end{tabular}
\vspace{4ex}
\noindent\begin{tabular}{@{}p{\linewidth}@{}}
Some text in which a question is posed:\\[1ex]
\ChoiceMenu[combo, name=percorso, charsize=12pt, width=5cm]{}{Answer1, Answer2}\\
\end{tabular}
\vspace{4ex}
\noindent\begin{tabular}{@{}m{.7cm}@{}*2{C{1.4cm}@{}}}
& Male & Female\\
Sex: &
\ChoiceMenu[radio,radiosymbol=\ding{108},default=f,name=sex,charsize=14pt,width=1em]{}{=m} &
\ChoiceMenu[radio,radiosymbol=\ding{108},default=f,name=sex,charsize=14pt,width=1em]{}{=f}\\
\end{tabular}
\vspace{4ex}
\noindent\CheckBox[name=highschool,charsize=12pt]{High School}
\CheckBox[name=college,charsize=12pt]{College}
\CheckBox[name=university,charsize=12pt]{University}
\vspace{4ex}
\noindent\begin{tabular}{@{}p{\linewidth}@{}}
Comment:\\[1ex]
% multiline from: https://tex.stackexchange.com/a/109709/101651
\TextField[name=comment,width=\linewidth,height=10cm,multiline=true]{}\\
\end{tabular}
\vspace{4ex}
\noindent\Submit{Submit}
\Reset{Clear}
\end{Form}
\end{document}