[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: remove pdfa test, /AA is still wrong ... (8ec21fa)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Jan 5 00:03:44 CET 2021


Repository : https://github.com/latex3/pdfresources
On branch  : reworking-annot
Link       : https://github.com/latex3/pdfresources/commit/8ec21fa82e00a8c42b6debf46d5fff8ad01f3cce

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

commit 8ec21fa82e00a8c42b6debf46d5fff8ad01f3cce
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jan 5 00:03:44 2021 +0100

    remove pdfa test, /AA is still wrong ...


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

8ec21fa82e00a8c42b6debf46d5fff8ad01f3cce
 hyperref-generic.dtx | 167 ++++++++++++++++++++++++---------------------------
 1 file changed, 80 insertions(+), 87 deletions(-)

diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index 231c03c..2406138 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -97,8 +97,24 @@
 %  a warning). Currently with latex+dvips links can not be broken. But there is work
 %  in progress to change this.
 %  \item[unicode] This is always true.
-%  \item[pdfa] The |pdfa| is used in hyperref to check a small number of requirements
-%  for the PDF standard PDF/A. 
+%  \item[pdfa] If this option is set to true \pkg{hyperref} checks and sets
+%  a small number of requirements for the PDF standard PDF/A.
+%  The key is ignored with this driver. Instead the wanted standard should be declared
+%  in \cs{DeclareDocumentMetadata}:
+%  \begin{verbatim}
+%  \DeclareDocumentMetadata{standard=A-2b}
+%  \end{verbatim}
+%  Currently |A-1b|, |A-2b|, |A-3b| can be set.
+%  The support for various requirements is still incomplete, but the parts that
+%  \pkg{hyperref} already checked are implemented:
+%  \begin{itemize}
+%  \item The |/F| key is added to links and Print is activated, Hidden, Invisible,
+%   NoView are deactivated.
+%  \item |/NeedAppearances| is suppressed
+%  \item  Pushbuttons, which use the action |/S/JavaScript| are suppressed
+%  \item  Resetbuttons, which use the action |/S/ResetForm| are suppressed Resetbutton
+%  \item  In widget annotations, the /AA dictionary is suppressed.
+%  \end{itemize}
 %  \end{description}
 %  \subsection{Destinations}
 %  Destinations (sometimes call anchors in the \pkg{hyperref} documentation)
@@ -227,7 +243,6 @@
 %%                           currently simply \text_purify:n
 %% \__hyp_info_generate_addons: what did this do??
 %% list of new variables
-%% \l_@@_pdfa_bool : for pdfa option (unclear if it will stay)
 %% \c_@@_dest_undefined_tl
 %% \g__hyp_AcroForm_CoFields_prop
 %% \g__hyp_AcroForm_Fields_prop
@@ -534,11 +549,6 @@
 % booleans
 \bool_new:N \l_@@_tmpa_bool
 \bool_new:N \l_@@_dest_box_bool
-%%% pdfa key:
-\bool_new:N \l_@@_pdfa_bool
-\ifHy at pdfa
-  \bool_set_true:N \l_@@_pdfa_bool
-\fi
 
 \prop_const_from_keyval:Nn \c__hyp_map_linktypes_prop
   {
@@ -584,33 +594,6 @@
 % module dictionary for trans:
 \pdfdict_new:n   {l_@@_page/Trans}
 \pdfdict_put:nnn {l_@@_page/Trans}{Type}{/Trans}
-% this need sorting out later. pdf standards should be handled outside the driver.
-% pdfa forces the flag /F 4 in some places.
-\AtBeginDocument
-  {
-    \bool_if:NT \l_@@_pdfa_bool
-      {
-        \pdfannot_dict_put:nnn
-          {link/URI}
-          { F }
-          { 4 }
-
-        \pdfannot_dict_put:nnn
-          {link/GoTo}
-          { F }
-          { 4 }
-
-        \pdfannot_dict_put:nnn
-          {link/GoToR}
-          { F }
-          { 4 }
-
-        \pdfannot_dict_put:nnn
-          {link/Named}
-          { F }
-          { 4 }
-      }
-  }
 
 %% conversion macro, replacement for \pdfstringdef
 % first the purify step
@@ -1672,6 +1655,7 @@
            \tl_set:Nn \l_@@_dest_pdfremotestartview_tl {Fit}
          }
      }
+   ,pdfremotestartview .initial:n = {Fit}
    % pdfstartpage is special as it shares code with pdfstartview
    ,pdfstartpage .code:n =
      {
@@ -2326,13 +2310,16 @@
          {Helv} {\pdf_object_ref:n {l_@@_font_helvetica_obj} }
        \pdfmanagement_add:nnx {Catalog /AcroForm}
          {DA}{(/Helv~10~Tf~0~g)}
-       \legacy_if:nF { Hy at pdfa } %?????? Standards?
-         {
-           \legacy_if:nT { HyField at NeedAppearances }
-             {
-               \pdfmanagement_add:nnx {Catalog / AcroForm }{NeedAppearances}{true}
-             }
-         }
+       \exp_args:Ne
+         \tl_if_eq:nnF
+           {\prop_item:Nn \g_pdfmeta_standard_prop {form_NeedAppearances}}
+           {false}
+           {
+             \legacy_if:nT { HyField at NeedAppearances }
+               {
+                 \pdfmanagement_add:nnx {Catalog / AcroForm }{NeedAppearances}{true}
+               }
+           }
        }
      \MakeFieldObject
        {
@@ -2593,7 +2580,7 @@
       \DefaultOptionsofPushButton,#1
      }
     \PDFForm at Name
-    \bool_if:NTF \l_@@_pdfa_bool
+    \exp_args:Ne\tl_if_in:nnTF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{JavaScript}
      {
       \msg_error:nn { hyp }{ pdfa-no-push-button }
        \LayoutPushButtonField
@@ -2672,7 +2659,7 @@
          \DefaultOptionsofReset,#1
        }
      \mode_leave_vertical:
-     \bool_if:NTF \l_@@_pdfa_bool
+      \exp_args:Ne\tl_if_in:nnTF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{ResetForm}
        {
          \msg_error:nn { hyp }{ pdfa-no-reset-button }
          \MakeButtonField{#2}
@@ -2859,7 +2846,7 @@
   \endgroup
   \let#1\Hy at gtemp
 }
-\def\Fld@@additionalactions{%
+\def\Fld at X@additionalactions{%
   \ifx\Fld at keystroke@code\@empty
   \else
     /K<</S/JavaScript/JS(\Hy at escapestring{\Fld at keystroke@code})>>%
@@ -2901,15 +2888,19 @@
     /X<</S/JavaScript/JS(\Hy at escapestring{\Fld at onexit@code})>>%
   \fi
 }
-\def\Fld at additionalactions{%
-  \if-\Fld@@additionalactions-%
-  \else
-    \ifHy at pdfa
-    \else
-      /AA<<\Fld@@additionalactions>>%
-    \fi
-  \fi
-}
+\ExplSyntaxOn
+\def\Fld at additionalactions
+ {%
+  \tl_if_empty:NF\Fld at X@additionalactions
+    {
+      \exp_args:Ne
+        \tl_if_eq:nnF
+          {\prop_item:Nn \g_pdfmeta_standard_prop {annot_widget_AA}}
+          {false}
+          {/AA<<\Fld at X@additionalactions>>}
+    }
+ }
+\ExplSyntaxOff
 \def\Fld at annotnames{%
   /T(\Fld at name)%
   \ifx\Fld at altname\relax
@@ -2975,7 +2966,7 @@
 }
 \ExplSyntaxOff
 \ExplSyntaxOn
-\legacy_if:nF { Hy at pdfa }
+\exp_args:Ne\tl_if_in:nnF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{JavaScript}
   {
    \def\PDFForm at Push
      {
@@ -3169,38 +3160,40 @@
   >>%
   \Fld at additionalactions
 }
-\ifHy at pdfa
-\else
-  \def\PDFForm at Reset{%
-    /Subtype/Widget%
-    \Fld at annotflags
-    \Fld at pageobjref
-    \Fld at annotnames
-    /FT/Btn%
-    \Fld at flags
-    /H/P%
-    /DA(/Helv \strip at pt\Fld at charsize\space Tf 0 0 1 rg)%
-    \ifcase0\ifnum\Fld at rotation=\z@   \else 1\fi
-            \ifx\Fld at bordercolor\relax\else 1\fi
-            \space
-    \else
-      /MK<<%
-        \ifnum\Fld at rotation=\z@
-        \else
-          /R \Fld at rotation
-        \fi
-        \ifx\Fld at bordercolor\relax
-        \else
-          /BC[\Fld at bordercolor]%
-        \fi
-      >>%
-    \fi
-    /BS<</W \Fld at borderwidth/S/\Fld at borderstyle>>%
-    /A<</S/ResetForm>>%
-    \Fld at additionalactions
-  }%
-\fi
-
+\ExplSyntaxOn
+\exp_args:Ne
+  \tl_if_in:nnF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{ResetForm}
+    {
+       \def\PDFForm at Reset{%
+         /Subtype/Widget%
+         \Fld at annotflags
+         \Fld at pageobjref
+         \Fld at annotnames
+         /FT/Btn%
+         \Fld at flags
+         /H/P%
+         /DA(/Helv~\strip at pt\Fld at charsize\space Tf~0~0~1~rg)%
+         \ifcase0\ifnum\Fld at rotation=\z@   \else 1\fi
+                 \ifx\Fld at bordercolor\relax\else 1\fi
+                 \space
+         \else
+           /MK<<%
+             \ifnum\Fld at rotation=\z@
+             \else
+               /R~\Fld at rotation
+             \fi
+             \ifx\Fld at bordercolor\relax
+             \else
+               /BC[\Fld at bordercolor]%
+             \fi
+           >>%
+         \fi
+         /BS<</W \Fld at borderwidth/S/\Fld at borderstyle>>%
+         /A<</S/ResetForm>>%
+         \Fld at additionalactions
+       }%
+   }
+\ExplSyntaxOff
 % UF: removed Hy at writebookmark
 %     \Hy at currentbookmarklevel{0}
 %     \Hy at numberline





More information about the latex3-commits mailing list.