3

Since my last update of Texlive, I have conflict when loading animate and exerquiz in the same document: the document compiles, the animation plays well in Acrobat, but when I open the pdf with another reader (evince, okular,...) that do not support animations, I have only a white rectangle in place of my animation, instead of the first frame.

MWE:

\documentclass{standalone} 
\usepackage{animate}
%\usepackage{exerquiz} % uncomment this line and the animation preview disappear

\begin{document}

Watch this counter:\begin{animateinline}[loop,autoplay,poster=0,controls]{2}
    \multiframe{10}{in=0+1}{%
        \fbox{\in}
    }
\end{animateinline}

\end{document}

When I compile this MWE, and open it in evince, I see the counter 0 in the fbox, and the controls beneath.

When I uncomment the \usepackage{exerquiz} line and compile this MWE, and open it with evince, I see nothing except "Watch this counter:"; but in Acrobat the animation still plays.

This did not happen before I updated Texlive; I always saw the first frame in evince. How can I restore the old behaviour?

1
  • Strange observation: when I open with evince a pdf file generated 3 months ago in the same conditions, the animation preview doesn't display; while it did 3 months ago. So it is not a question of Texlive update. Is this problem related to the end of Flash support?
    – JPG
    Feb 15, 2021 at 7:46

1 Answer 1

3

At some point in the loading chain of packages, hyperref is invoked in a way that puts the key /NeedAppearances true in the AcroForm dictionary of the PDF Catalog. NeedAppearances is declared deprecated in the current ISO PDF-2.0 standard.

Also, animate and hyperref concurrently want to write the Fields entry in the AcroForm dictionary, if hyperref's Form environment is set (implicitly done by exerquiz).

The following fix suppresses NeedAppearances in the PDF output and hooks into hyperref's mechanism of Form field registration:

\documentclass{standalone} 

\usepackage{animate}
\usepackage{exerquiz}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Fix compatibility with hyperref Forms %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ExplSyntaxOn
\makeatletter
% suppress deprecated /NeedAppearances true|false
\HyField@NeedAppearancesfalse
% hook into hyperref's Form Field registration
\cs_set_protected_nopar:Nn\pbs_appendtofields:n{
  \tl_gput_left:Nx\HyField@afields{#1\space}
}
\makeatother
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Watch this counter:\begin{animateinline}[loop,autoplay,controls]{2}
    \multiframe{10}{in=0+1}{%
        \fbox{\in}
    }
\end{animateinline}

\end{document}
7
  • Thanks a lot, it works perfectly.
    – JPG
    Feb 18, 2021 at 18:52
  • Sorry, but I was too quick to say it worked. Now, I have good preview in Evince, but no more animation in Acrobat.
    – JPG
    Feb 22, 2021 at 18:25
  • @JPG Now it works again in AcroRead.
    – AlexG
    Feb 22, 2021 at 21:11
  • (Okular still fails to play; it seems to choke on some document-level JavaScript introduced by exerquiz.)
    – AlexG
    Feb 22, 2021 at 21:19
  • Yes it now works again; thanks. I tried with Okular and... surprise! My animation plays! What? Okular can now play animated PDF? Did anyone knew that?
    – JPG
    Feb 22, 2021 at 21:27

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.