Closed gildasprevost closed 2 years ago
I would need small (!) example pdf with such a field so that I can check how it is encoded.
Yes of course! Exemple.pdf
It should be smaller. Remove all the other fields and the graphics. The example should only contain the one field for the image. And describe how you create it in adobe.
As I wrote here https://texnique.fr/osqa/questions/10834/formulaire-pdf-avec-image-modifiable this is only a button field with a javascript action. A simple version looks like this
\RequirePackage{pdfmanagement-testphase} % not needed with latex-dev
\DocumentMetadata{uncompress}
\documentclass{article}
\usepackage{l3pdffield-testphase}
\begin{document}
\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{name=bild,width=10cm,height=8cm,MK/TP=1}
\group_end:
\ExplSyntaxOff
\end{document}
Border, colors etc can be adjusted with the existing methods.
The same should be possible with the existing \PushButton field of hyperref.
That's perfect, thank you very much for this solution!