[latex3-commits] [git/LaTeX3-latex3-pdfresources] test-new-hooks: acrobat menu and pdfa (863aef2)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon May 18 00:34:49 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : test-new-hooks
Link       : https://github.com/latex3/pdfresources/commit/863aef20f413253509a2f1f59aa99498ea5e7788

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

commit 863aef20f413253509a2f1f59aa99498ea5e7788
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon May 18 00:34:49 2020 +0200

    acrobat menu and pdfa


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

863aef20f413253509a2f1f59aa99498ea5e7788
 hgeneric-experimental.def | 56 ++++++++++++++++++++++++++++++++---------------
 l3pdfmeta.dtx             | 10 +++------
 2 files changed, 41 insertions(+), 25 deletions(-)

diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index 5523444..ccc3735 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -38,7 +38,7 @@
 %%   \Hy at EXPsetbordercolor
 %%   \hypupdateattribute
 \ProvidesFile{hgeneric-experimental.def}
-  [2020/03/16 v0.5 %
+  [2020/05/17 v0.6 %
   Hyperref driver for luaTeX]
 \RequirePackage{pdfresources}
 \RequirePackage{xparse,etoolbox}
@@ -188,6 +188,7 @@
 \tl_new:N  \g__hyp_pdfstartview_tl
 
 % booleans
+\bool_new:N \l__hyp_tmpa_bool
 %%% pdfa key:
 \bool_new:N \l__hyp_pdfa_bool
 \ifHy at pdfa
@@ -1653,27 +1654,46 @@
 
 %%% UF removed setpagesize code, should be done by kernel/graphicx
 
-\def\Acrobatmenu#1#2{%
-  \Hy at Acrobatmenu{#1}{#2}{%
-    \mode_leave_vertical:
-    \EdefEscapeName\Hy at temp@menu{#1}%
-    \pdfannot_link:nnn { Named }
-      {
-        /A
-          <<
-            /S/Named
-            /N\pdftool_name_print:n{#1}
-            \Hy at href@nextactionraw
-          >>
+\def\Acrobatmenu#1#2
+ {
+   \prop_get:NnNTF \g_pdfmeta_standard_prop {named_actions} \l_tmpa_tl
+     {
+      \tl_if_in:NnTF \l_tmpa_tl { #1 }
+        {
+          \bool_set_true:N \l__hyp_tmpa_bool %restricted but ok
+        }
+        {
+          \bool_set_false:N \l__hyp_tmpa_bool %restricted not ok
+        }
+     }
+     {
+      \bool_set_true:N \l__hyp_tmpa_bool % no restrictions
+     }
+   \bool_if:NTF \l__hyp_tmpa_bool
+     {
+       \mode_leave_vertical:
+       \pdfannot_link:nnn { Named }
+         {
+           /A
+             <<
+               /S/Named
+               /N\pdftool_name_print:n{#1}
+               \Hy at href@nextactionraw
+             >>
+         }
+         {
+           \Hy at colorlink\@menucolor#2
+           \Hy at xspace@end
+           \Hy at endcolorlink
+           \Hy at VerboseLinkStop
+         }
       }
       {
-       \Hy at colorlink\@menucolor#2
-       \Hy at xspace@end
-       \Hy at endcolorlink
-       \Hy at VerboseLinkStop
+        % named action not allowed ...
+        % error??
+        #2
       }
   }
-}
 \ExplSyntaxOff
 %%% UF removed old atbegshi fix
 \ExplSyntaxOn
diff --git a/l3pdfmeta.dtx b/l3pdfmeta.dtx
index 2fb0985..04bee90 100644
--- a/l3pdfmeta.dtx
+++ b/l3pdfmeta.dtx
@@ -95,6 +95,7 @@
 % \end{NOTE}
 % \begin{function}[added=2019-08-25]{\DeclareDocumentMetaData}
 %    \begin{macrocode}
+%<@@=pdf>
 \NewDocumentCommand\DeclareDocumentMetaData { m }
   {
     \cs_if_eq:NNTF \documentclass \@twoclasseserror
@@ -122,7 +123,7 @@
     ,standard .choices:nn =
       {A-1b,A-2b,A-3b}
       {
-        \prop_gset_eq:Nc \g_@@_meta_standard_prop { g_@@_meta_standard_pdf/#1_prop }
+        \prop_gset_eq:Nc \g_pdfmeta_standard_prop { g_@@_meta_standard_pdf/#1_prop }
       }
     ,standard / unknown .code:n =
       {
@@ -133,7 +134,6 @@
 % \end{function}
 % \section{XMP-metadata}
 %    \begin{macrocode}
-%<@@=pdf>
 % we need a command to write a BOM to the pdf:
 \str_const:Nx\c_@@_meta_bom_str
  {
@@ -166,10 +166,6 @@
 %
 %    \begin{macrocode}
 
-
-% we will need a boolean to suppress the metadata if wanted ...
-\bool_new:N \g_@@_meta_bool
-
 \hook_gput_code:nnn {shipout/lastpage}{pdf}
   {
     \bool_if:NT \g_@@_meta_bool
@@ -188,7 +184,7 @@
 % \subsection{pdf/A}
 %    \begin{macrocode}
 
-\prop_new:N \g_@@_meta_standard_prop
+\prop_new:N \g_pdfmeta_standard_prop
 
 \prop_new:c { g_@@_meta_standard_pdf/A-1b_prop }
 \prop_set_from_keyval:cn { g_@@_meta_standard_pdf/A-1b_prop }





More information about the latex3-commits mailing list.