j'ai appris à faire des formulaires avec hyperref, cela me permettait de créer des exercices aléatoirisés par élève, et un programme en python fait avec mes petites mains me permettait de récupérer les réponses avec le module pypdf.
J'ai souhaité ces jours derniers intégrer une animation avec animate, dans un exercice aléatoirisé et là bouuh ça ne marche pas comme je le souhaiterais.
Voici un ECM en latex
-> un champ à saisir +une animation (vide)
Code : Tout sélectionner
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pst-all}
\usepackage{hyperref}
\usepackage{animate}
\begin{document}
\begin{Form}
\begin{itemize}
\item Saisir un chiffre : \TextField[name=Ab0,align=1,height=5mm,width=5mm]{}
\item Ci-dessous une animation :
\begin{center}
\begin{animateinline}[controls={play,step,stop}]{1}
\multiframe{1}{rA=0.0+10}{%
\begin{pspicture*}(0,0)(9.5,6.3)
%
\end{pspicture*}
}
\end{animateinline}
\end{center}
\end{itemize}
\end{Form}
\end{document}
Code : Tout sélectionner
import pypdf
# récupération du formulaire du pdf rendu
rendu='ECM_00.pdf'
reader = pypdf.PdfReader('./'+rendu)
output=reader.get_fields()
print(output)
Code : Tout sélectionner
{'0.EndRight': {'/T': '0.EndRight', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/D': {'/JS': 'a0_stopLast();', '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.StepRight': {'/T': '0.StepRight', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/D': {'/JS': 'a0_stepFwd();', '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.PlayPauseRight': {'/T': '0.PlayPauseRight', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/D': {'/JS': 'a0_playPauseFwd();', '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.PlayRight': {'/T': '0.PlayRight', '/FT': '/Btn', '/Ff': 65537, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.PauseRight': {'/T': '0.PauseRight', '/FT': '/Btn', '/Ff': 65537, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.PlayPauseLeft': {'/T': '0.PlayPauseLeft', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/D': {'/JS': 'a0_playPauseBwd();', '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.PlayLeft': {'/T': '0.PlayLeft', '/FT': '/Btn', '/Ff': 65537, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.PauseLeft': {'/T': '0.PauseLeft', '/FT': '/Btn', '/Ff': 65537, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.StepLeft': {'/T': '0.StepLeft', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/D': {'/JS': 'a0_stepBwd();', '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.EndLeft': {'/T': '0.EndLeft', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/D': {'/JS': 'a0_stopFirst();', '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, 'anm0': {'/T': 'anm0', '/FT': '/Btn', '/Ff': 65536, '/AA': {'/PO': {'/JS': IndirectObject(49, 0, 1555790551024), '/S': '/JavaScript'}, '/PI': {'/JS': IndirectObject(50, 0, 1555790551024), '/S': '/JavaScript'}, '/PV': {'/JS': IndirectObject(49, 0, 1555790551024), '/S': '/JavaScript'}, '/D': {'/JS': 'try{if(a0_playing){a0_pause();}}catch(e){}', '/S': '/JavaScript'}, '/U': {'/JS': 'try{if(event.shift)a0_playsRight=!a0_playsRight;var\ndoplay=true;if(a0_idx==0&&a0_playsRight){a0_stopFirst();}if(a0_idx==0&&!a0_playsRight){a0_stopLast();}if(doplay){if(a0_playsRight){a0_playRight();}else{a0_playLeft();}}}catch(e){}', '/S': '/JavaScript'}, '/PC': {'/JS': IndirectObject(50, 0, 1555790551024), '/S': '/JavaScript'}}, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}, '0.0': {'/T': '0.0', '/FT': '/Btn', '/Ff': 65537, '/_States_': ['/Filter', '/Type', '/Subtype', '/FormType', '/BBox', '/Matrix', '/Resources', '/Off']}}
Code : Tout sélectionner
{'Ab0': {'/T': 'Ab0', '/FT': '/Tx', '/V': '', '/DV': ''}}