After working with hyperref forms I have noticed that employing some format options produces a strange behaviour when opening the output PDF (in PDF XChange viewer/editor at least): the program shows an asterisk warning about changes made in the file, asking if you want to save them when closing it. What is the reason behind and how to solve this problem? I attach a MWE:


    \TextField[%width=4cm, height=.25cm, %
    name = field,
    format = {%
        var f = this.getField('field');%
%       f.textFont = ['Calibri Light'];%< -- -- -- PROBLEM
%        f.strokeColor = ['T'];%        < -- -- -- PROBLEM
%        f.fillColor = ['T'];%          < -- -- -- PROBLEM
%       f.alignment = ['center']%       < -- -- -- PROBLEM
    charsize = 10.5pt,%
%   color= blue,
%    value=test

hyperref forces NeedAppearances to true when form fields are used (that's an internal pdf setting). This means that when loading the pdf the reader changes the pdf to show the borders around the fields, and when quitting it asks you if you want to save the changes.

You can set the value to false with


You then should perhaps changes the settings in the reader (Edit->Forms) so that they show a background:

enter image description here

In the long run hyperref should/will add the borders through an dictionaries of the form fields (/NeedAppearances is deprecated in pdf 2.0), but this will take some time to implement.

|improve this answer|||||
  • No. It is not the Form, but only certain options. Indeed, this solution does not work for me. On the other hand, Xchange viewer is not showing other colors than 'T', but just warning about changes. – Andrestand Jun 10 '19 at 7:32
  • Well with adobe it is already the form (and NeedAppearances=false). With pdf xchange it seems only to appear if one activate one of your options in the example (and it would have been better if you hadn't commented them if they are part of the problem). I don't think that there is anything that can be done by hyperref, that's clearly a decision of the pdf viewer. – Ulrike Fischer Jun 11 '19 at 13:29
  • @KJO form is required when the information that must fill the gap is not available before producing the PDF. So other person is going to fill it, and it needs to emulate the sffamily from kpfonts. That font option is the only I found. – Andrestand Jun 11 '19 at 17:00

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.