[latex3-commits] [git/LaTeX3-latex3-pdfresources] radiobuttons: working on submit (bc309b6)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon Jun 7 23:42:43 CEST 2021


Repository : https://github.com/latex3/pdfresources
On branch  : radiobuttons
Link       : https://github.com/latex3/pdfresources/commit/bc309b6c1766b9e09df7de69060c3d9bf491bb01

>---------------------------------------------------------------

commit bc309b6c1766b9e09df7de69060c3d9bf491bb01
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon Jun 7 23:42:43 2021 +0200

    working on submit


>---------------------------------------------------------------

bc309b6c1766b9e09df7de69060c3d9bf491bb01
 l3pdffield-action.dtx | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/l3pdffield-action.dtx b/l3pdffield-action.dtx
index f33b07e..e066673 100644
--- a/l3pdffield-action.dtx
+++ b/l3pdffield-action.dtx
@@ -181,6 +181,11 @@
 %
 % \subsubsection{SubmitForm}
 %
+% SubmitForm is the most challenging action. There are more keys in the dictionary,
+% 13 flags, and there are four export options, which require each some flag settings.
+%
+%
+%
 %
 %
 % \bigskip
@@ -333,6 +338,7 @@
 %  }
 %    \begin{macrocode}
 \tl_new:N  \l_@@_action_Flags_tl
+\tl_new:N  \l_@@_action_export_tl
 \seq_new:N \l_@@_action_Fields_seq
 \str_new:N \l_@@_action_F_str
 %    \end{macrocode}
@@ -346,7 +352,25 @@
 \pdfdict_put:nnn {l_@@/SubmitForm}{Type}{/Action}
 \pdfdict_put:nnn {l_@@/SubmitForm}{S}{/SubmitForm}
 %    \end{macrocode}
-%
+% \subsection{bitset for submit action}
+%    \begin{macrocode}
+\bitset_new:Nn \l_@@_Flags_bitset
+  {
+     Include/Exclude      = 1
+    ,IncludeNoValueFields = 2
+    ,ExportFormat         = 3
+    ,GetMethod            = 4
+    ,SubmitCoordinates    = 5
+    ,XFDF                 = 6
+    ,IncludeAppendSaves   = 7
+    ,IncludeAnnotations   = 8
+    ,SubmitPDF            = 9
+    ,CanonicalFormat      = 10
+    ,ExclNonUserAnnots    = 11
+    ,ExclFKey             = 12
+    ,EmbedForm            = 14
+  }
+%    \end{macrocode}
 % \subsection{Keys}
 %    \begin{macrocode}
 
@@ -392,6 +416,10 @@
       }
     ,exclude .code:n = {\tl_set:Nn \l_@@_action_Flags_tl {1}}
     ,include .code:n = {\tl_set:Nn \l_@@_action_Flags_tl {0}}
+    ,export .choices:nn = {pdf,fdf,html,xfdf}
+      {
+        \tl_set:Nn \l_@@_action_export_tl {#1}
+      }
   }
 %    \end{macrocode}
 %
@@ -425,6 +453,35 @@
   }
 \@@_action_reset_new:nn  {all}{fields={},exclude}
 %    \end{macrocode}
+% \subsection{New submit action}
+%
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_action_submit_new:nn #1 #2 %#1 name, #2 keyval
+  {
+    \group_begin:
+    \seq_clear:N \l_@@_action_Fields_seq
+    \keys_set:nn { pdffield / action }{ #2 }
+    \cs_new_protected:cpx {@@_action_submit_#1:}
+      {
+        \exp_not:N \@@_action_submit_aux:nnn
+         {\seq_use:Nn \l_@@_action_Fields_seq {~}}
+         { \l_@@_action_Flags_tl }
+         {#1}
+      }
+    \group_end:
+  }
+
+\cs_new_protected:Npn \@@_action_submit_aux:nnn #1 #2 #3 % fields content, #2 flag, #3 name
+  {
+    \pdf_object_unnamed_write:nx {array}{#1}
+    \pdfdict_put:nnn {l_@@/SubmitForm}{Fields}{\pdf_object_ref_last:}
+    \pdfdict_put:nnn {l_@@/SubmitForm}{Flags}{#2}
+    \pdf_object_unnamed_write:nx {dict} {\pdfdict_use:n{l_@@/SubmitForm}}
+    \tl_const:cx { c_@@_action_reset_#3_tl }{ \pdf_object_ref_last: }
+    \cs_gset_eq:cN {@@_action_reset_#3:} \prg_do_nothing:
+  }
+\@@_action_reset_new:nn  {all}{fields={},exclude}
+%    \end{macrocode}
 %
 %
 % \subsection{user commands}





More information about the latex3-commits mailing list.