There's a flag called NoToggleToOff
which should control this behavior according to the PDF specification, p. 439:
(Radio buttons only) If set, exactly one radio button shall be selected at all times; selecting the currently selected button has no effect. If clear, clicking the selected button deselects it, leaving no button selected.
However, this does not work as expected: even if the flag is not set, I wasn't able to deselect a once selected radio button. I tried with different viewers (Adobe Reader X, PDF-XChange Viewer, Foxit Reader [Windows]) and with PDF documents produced by different programs (LaTeX using hyperref
, OpenOffice, iText), with no success. Apparently, this feature of the specification isn't implemented in any of the current PDF viewers!
So how were the radio buttons in the linked form created?
The answer is quite surprising: The "radio buttons" in this PDF don't have the Radio
flag set, which technically turns them into simple check boxes. However, as you can see, they still behave like radio buttons, so you can only select one option at a time. You can exploit this oddity by removing this flag in the form fields created by hyperref
:
\documentclass{article}
\usepackage[bookmarks=false]{hyperref}
% Make radio buttons completely deselectable by removing the "Radio" flag
% (http://tex.stackexchange.com/a/74543/3323)
\usepackage{etoolbox}
\makeatletter
\patchcmd{\HyField@FlagsRadioButton}{\HyField@SetFlag{Ff}{Radio}}{}{}{}
\makeatother
\def\DefaultOptionsofRadio{print}
\begin{document}
\begin{Form}
{Do you want to: }%
\ChoiceMenu[radio,radiosymbol=\ding{52},name=myGroupOfRadiobuttons]{}{Do it all again=Again}
\ChoiceMenu[radio,radiosymbol=\ding{52},name=myGroupOfRadiobuttons]{}{Pretend it never happened=Pretend}
\ChoiceMenu[radio,radiosymbol=\ding{52},name=myGroupOfRadiobuttons]{}{Write a book about it=Write}
\end{Form}
\end{document}
Like this, you get completely deselectable radio buttons like the ones in the form you provided.
I am not sure if I understand your question correctly, but if you want to shift the box, you can play around with \raisebox{}{}
:
\documentclass[a4paper, 10pt]{article}
\usepackage{hyperref}
\usepackage{mathptmx}
\usepackage[scaled=.92]{helvet}
\usepackage{courier}
\usepackage[T1]{fontenc}
\begin{document}
\begin{center}
{%
\huge
Route
\raisebox{-.25\baselineskip}{
\begin{Form}
\TextField[name=route_number, maxlen=4, width=1.8cm, charsize=20pt, align=1]{}
\end{Form}
}
New Schedule Survery
}
\end{center}
\end{document}
Please also note, that \huge
and similar commands do not take an argument.
Best Answer
The printing of the field is controlled by
\MakeTextField
whose default definition is equivalent toReplacing the inside
\hfill
with an\hrulefill
produces a horizontal line, but because of the placing of the\vfill
these will be at the top of the box. Moving the placement of\vfill
gives a line at the bottom viaYou will probably want to adjust the colour to black (rather than the gray I get as default):