[latex3-commits] [git/LaTeX3-latex3-pdfresources] reworking-annot: simplify and correct pdf/A-tests, small errors (42f585e)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Jan 5 15:18:49 CET 2021


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

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

commit 42f585e2f38a8b0bc0f1af89b8ca5de1c5794853
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Jan 5 15:18:49 2021 +0100

    simplify and correct pdf/A-tests, small errors


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

42f585e2f38a8b0bc0f1af89b8ca5de1c5794853
 hyperref-generic.dtx | 98 +++++++++++++++++++++++++---------------------------
 l3pdfmeta.dtx        | 29 +++++++++++++---
 2 files changed, 72 insertions(+), 55 deletions(-)

diff --git a/hyperref-generic.dtx b/hyperref-generic.dtx
index 2406138..7b25997 100644
--- a/hyperref-generic.dtx
+++ b/hyperref-generic.dtx
@@ -97,7 +97,7 @@
 %  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] If this option is set to true \pkg{hyperref} checks and sets
+%  \item[pdfa] If this option is set to true \pkg{hyperref} normally 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}:
@@ -1154,7 +1154,7 @@
           /S/GoToR
           \Hy at SetNewWindow
           \ifx\\#3\\
-            /D[\Hy at href@page\l_@@_dest_pdfremotestartview_tl]
+            /D[\Hy at href@page/\l_@@_dest_pdfremotestartview_tl]
           \else
             /D( \l_@@_dest_name_tmpa_tl )
           \fi
@@ -2310,16 +2310,16 @@
          {Helv} {\pdf_object_ref:n {l_@@_font_helvetica_obj} }
        \pdfmanagement_add:nnx {Catalog /AcroForm}
          {DA}{(/Helv~10~Tf~0~g)}
-       \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}
-               }
-           }
+       \prop_if_in:NnTF\g_pdfmeta_standard_prop {form_no_NeedAppearance}
+         {
+           \pdfmanagement_remove:nn {Catalog / AcroForm }{NeedAppearances}
+         }
+         {
+           \legacy_if:nT { HyField at NeedAppearances }
+             {
+               \pdfmanagement_add:nnn {Catalog / AcroForm }{NeedAppearances}{true}
+             }
+         }
        }
      \MakeFieldObject
        {
@@ -2580,36 +2580,36 @@
       \DefaultOptionsofPushButton,#1
      }
     \PDFForm at Name
-    \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
-        {
-         \mode_leave_vertical:
-         \MakeButtonField{#2}
-        }
-     }
-     {
-      \HyField at FlagsPushButton
-      \legacy_if:nT {Fld at hidden}
-        {
-          \def\Fld at width{1sp}
-        }
-      \LayoutPushButtonField
-       {
-        \mode_leave_vertical:
-        \HyAnn at AbsPageLabel
-        \Hy at escapeform\PDFForm at Push
-        \hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}}
-        \pdfannot_box:nnnn
-          {\box_wd:N\l_tmpa_box}
-          {\box_ht:N\l_tmpa_box}
-          {\box_dp:N\l_tmpa_box} %is this correct?
-          {\PDFForm at Push}
-         {\box_use:N\l_tmpa_box}
-        \HyField at AddToFields
-       }
+    \prop_if_in:NnTF \g_pdfmeta_standard_prop {annot_action_no_A}
+      {
+        \msg_error:nn { hyp }{ pdfa-no-push-button }
+        \LayoutPushButtonField
+          {
+            \mode_leave_vertical:
+            \MakeButtonField{#2}
+          }
       }
+      {
+        \HyField at FlagsPushButton
+        \legacy_if:nT {Fld at hidden}
+          {
+            \def\Fld at width{1sp}
+          }
+        \LayoutPushButtonField
+          {
+            \mode_leave_vertical:
+            \HyAnn at AbsPageLabel
+            \Hy at escapeform\PDFForm at Push
+            \hbox_set:Nn \l_tmpa_box { \MakeButtonField {#2}}
+            \pdfannot_box:nnnn
+              {\box_wd:N\l_tmpa_box}
+              {\box_ht:N\l_tmpa_box}
+              {\box_dp:N\l_tmpa_box} %is this correct?
+              {\PDFForm at Push}
+             {\box_use:N\l_tmpa_box}
+            \HyField at AddToFields
+          }
+     }
   \group_end:
 }
 
@@ -2659,7 +2659,7 @@
          \DefaultOptionsofReset,#1
        }
      \mode_leave_vertical:
-      \exp_args:Ne\tl_if_in:nnTF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{ResetForm}
+     \prop_if_in:NnTF \g_pdfmeta_standard_prop {annot_action_no_A}
        {
          \msg_error:nn { hyp }{ pdfa-no-reset-button }
          \MakeButtonField{#2}
@@ -2891,13 +2891,10 @@
 \ExplSyntaxOn
 \def\Fld at additionalactions
  {%
-  \tl_if_empty:NF\Fld at X@additionalactions
+  \exp_args:Ne\str_if_eq:nnF {\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>>}
+      \prop_if_in:NnF \g_pdfmeta_standard_prop {annot_widget_no_AA}
+        {/AA<<\Fld at X@additionalactions>>}
     }
  }
 \ExplSyntaxOff
@@ -2966,7 +2963,7 @@
 }
 \ExplSyntaxOff
 \ExplSyntaxOn
-\exp_args:Ne\tl_if_in:nnF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{JavaScript}
+\prop_if_in:NnF \g_pdfmeta_standard_prop {annot_action_no_A}
   {
    \def\PDFForm at Push
      {
@@ -3161,8 +3158,7 @@
   \Fld at additionalactions
 }
 \ExplSyntaxOn
-\exp_args:Ne
-  \tl_if_in:nnF {\prop_item:Nn \g_pdfmeta_standard_prop {annot_no_actions}}{ResetForm}
+\prop_if_in:NnF \g_pdfmeta_standard_prop {annot_action_no_A}
     {
        \def\PDFForm at Reset{%
          /Subtype/Widget%
diff --git a/l3pdfmeta.dtx b/l3pdfmeta.dtx
index 23e177c..64a6095 100644
--- a/l3pdfmeta.dtx
+++ b/l3pdfmeta.dtx
@@ -194,7 +194,6 @@
     ,max_dict_size    = 4095
     ,max_obj_num      = 8388607
     ,max_nest_qQ      = 28
-    ,Catalog/OCProperties    = false
     ,named_actions    = {NextPage, PrevPage, FirstPage, LastPage}
     ,annot_flags      = {
                           \bitset_set_true:Nn  \l_pdfannot_F_bitset {Print}
@@ -207,9 +206,31 @@
                           \pdfannot_dict_put:nnn {link/Launch}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
                           \pdfannot_dict_put:nnn {link/Named}{F}{ \bitset_to_arabic:N \l_pdfannot_F_bitset }
                         }
-    ,annot_no_actions   =  {Launch, Sound, Movie, ResetForm, ImportData, JavaScript, Hide}
-    ,annot_widget_AA =  false %no /AA dictionary in widget dict. Subtype != "Widget" || AA_size == 0
-    ,form_NeedAppearances = false
+    %booleans. Only the existence of the key matter.
+    %If the entry is added it means true (so in most cases "don't use ...")
+    %
+    %===============
+    % Rule 6.1.13-1 CosDocument, isOptionalContentPresent == false
+      ,Catalog_no_OCProperties =
+    %===============
+    % Rule 6.6.1-1: PDAction, S == "GoTo" || S == "GoToR" || S == "Thread" || S == "URI" || S == "Named" || S == "SubmitForm"
+    % means: no /S/Launch, /S/Sound, /S/Movie, /S/ResetForm, /S/ImportData, /S/JavaScript, /S/Hide
+      ,annot_action_no_A        =
+    %===============
+    % Rule 6.6.2-1: PDAnnot, Subtype != "Widget" || AA_size == 0
+    % means: no AA dictionary
+      ,annot_widget_no_AA      =
+    %===============
+    % Rule 6.9-2: PDAnnot, Subtype != "Widget" || (A_size == 0 && AA_size == 0)
+    % (looks like a tightening of the previous rule)
+      ,annot_widget_no_A_AA    =
+    %===============
+    % Rule 6.9-1 PDAcroForm, NeedAppearances == null || NeedAppearances == false
+    ,form_no_NeedAppearances =
+    %===============
+    %Rule 6.9-3 PDFormField, AA_size == 0
+    ,form_no_AA              =
+    %===============
     % to be continued https://docs.verapdf.org/validation/pdfa-part1/
     % - Outputintent/colorprofiles requirements
     % - no Alternates key in image dictionaries





More information about the latex3-commits mailing list.