I would like to have typewriter-font into my pdf-form.
So I find out the mechanism
\TextField[width=5cm, name=NAME,value=Font manually changed,
format = { var f = this.getField('NAME'); f.textFont = 'Courier'; },
]{B: }
depending on the name
of the textfield.
I can do this smarter using a corresponding command, but I ask myself:
Is there a possibility to set the font globally for all textfields?
\documentclass[fontsize=14pt]{scrreprt}
\usepackage{xcolor}
\usepackage[]{hyperref}
% Gobal Styles
\def\Default{
print, bordercolor=red,backgroundcolor=lightgray,borderstyle={U},
}
\xdef\DefaultOptionsofText{\Default}
\begin{document}
\begin{Form}
\TextField[width=5cm, name=a,value=Default Font]{A: }
\TextField[width=5cm, name=b,value=Font manually changed,
format = { var f = this.getField('b'); f.textFont = 'Courier'; },
]{B: }
Let's do this with a newcommand:
% \TEXTFIELD[<opt. Arg.>]{<name>}{<title>}
\newcommand{\TEXTFIELD}[3][]{%%
\TextField[width=5cm,
name = #2,
format = { var f = this.getField('#2'); f.textFont = 'Courier'; },
#1,
]{#3}
}%%
\bigskip
\TEXTFIELD[value={Font changed}]{C}{C:}
\TEXTFIELD[value={Font changed too}]{D}{D:}
\end{Form}
\end{document}