J'ai un formulaire pdf avec plusieurs types de champs. Dans certains champs \pdfmanagement_add:nnn{Catalog/AcroForm}{NeedAppearances}{true} En revanche, avec l'activation de ce paramètre la valeur \RequirePackage{pdfmanagement-testphase} % not needed with latex-dev \DocumentMetadata{uncompress} \documentclass{article} \usepackage{l3pdffield-testphase} \begin{document} \ExplSyntaxOn \pdfmanagement_add:nnn{Catalog/AcroForm}{NeedAppearances}{true} %deprecated, optional {Champ:~}\pdffield_textfield:n{V=valeur~ par~ défaut,name=champtest,backgroundcolor=,bordercolor=black,width=6cm} \ExplSyntaxOff \ExplSyntaxOn \group_begin: \tl_set:Nn\l_tmpa_tl{event.target.buttonImportIcon();} \pdf_object_unnamed_write:nx{stream}{{}{\exp_not:o{\l_tmpa_tl}}} \pdfannot_dict_put:nnx{widget}{A}{<</S/JavaScript /JS~\pdf_object_ref_last:>>} \pdffield_pushbutton:n{V=Chargez,DV=Chargez,name=Logotest,caption=Logo,bordercolor=black,width=5cm,height=4cm,MK/TP=1} \group_end: \ExplSyntaxOff \end{document} |
Si tu veux utiliser NeedAppearance, il te faut definir un icon: \RequirePackage{pdfmanagement-testphase} % not needed with latex-dev \DocumentMetadata{uncompress} \documentclass{article} \usepackage{l3pdffield-testphase,tikz} \begin{document} \ExplSyntaxOn \pdfmanagement_add:nnn{Catalog/AcroForm}{NeedAppearances}{true} %deprecated, optional {Champ:~}\pdffield_textfield:n{V=valeur~ par~ défaut,name=champtest,backgroundcolor=,bordercolor=black,width=6cm} \par \pdfxform_new:nnn {logo-xform} {} { \tikz{\node[fill=red,font=\Huge\bfseries]{Logo}} %adapt size } \group_begin: \tl_set:Nn\l_tmpa_tl{event.target.buttonImportIcon();} \pdf_object_unnamed_write:nx{stream}{{}{\exp_not:o{\l_tmpa_tl}}} \pdfannot_dict_put:nnx{widget}{A}{<</S/JavaScript /JS~\pdf_object_ref_last:>>} \pdffield_pushbutton:n{V=Chargez,DV=Chargez,name=Logotest,caption=Logo, rollover-caption=blub, bordercolor=black,width=5cm,height=4cm,MK/TP=1, MK/I = \pdfxform_ref:n{logo-xform}} \group_end: \ExplSyntaxOff \end{document} Publiée 25 Avr '22, 23:47 Ulrike Fischer |