1

I wanted to have a "hide/show" PushButton to hide a certain field, which I managed (see MWE).

However, when the field is hidden, it still takes "space". Is there a way to not only hide the field itself but also the space it is taking in order for fields below to take their place (i.e. in this example, jump up) ?

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{Form}
\PushButton[
  name =switch,
  onclick= {%
    var test = this.getField("test");
    if (test.display == display.visible) {
    test.display = display.hidden;
    } else {
    test.display = display.visible;
    }
  }
]{Switch visibility} \\

\TextField [name=test, value= I will disappear]{} \\

\TextField [name=other, width=\textwidth, value= Can I take the place of the first field when it is hidden ?]{} \\
\end{Form}
\end{document}

Field visible Field hidden

  • Not possible. PDF is a format for documents with paginated content. If space of hidden objects were deleted, the following content would have to dynamically move between document pages to fill up the freed space. – AlexG Jan 22 at 7:45

Your Answer

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

Browse other questions tagged or ask your own question.