[latex3-commits] [git/LaTeX3-latex3-pdfresources] renamedict77: change catalog values from names to references (cfcfc2d)

Ulrike Fischer fischer at troubleshooting-tex.de
Mon Apr 13 00:24:53 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : renamedict77
Link       : https://github.com/latex3/pdfresources/commit/cfcfc2dee70aba39a844e30f8c066617dc706aff

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

commit cfcfc2dee70aba39a844e30f8c066617dc706aff
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Mon Apr 13 00:24:53 2020 +0200

    change catalog values from names to references


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

cfcfc2dee70aba39a844e30f8c066617dc706aff
 hgeneric-experimental.def     |  8 +++----
 pdfresources.dtx              | 50 +++++++++++++++++++------------------------
 testfiles-dvips/catalogAF.pvt |  4 ++--
 testfiles/catalogAF.pvt       |  4 ++--
 testfiles/ocproperties.pvt    |  6 +++---
 5 files changed, 33 insertions(+), 39 deletions(-)

diff --git a/hgeneric-experimental.def b/hgeneric-experimental.def
index d1af860..9fe1fff 100644
--- a/hgeneric-experimental.def
+++ b/hgeneric-experimental.def
@@ -527,8 +527,8 @@
               /View  <</ViewState/OFF>>~
              >>
           }
-       \pdfdict_put:nnn { Catalog / OCProperties }{OCGs }{ l__hyp_ocg_view_dict_obj }
-       \pdfdict_put:nnn { Catalog / OCProperties }{OCGs }{ l__hyp_ocg_print_dict_obj }
+       \pdfdict_put:nnx { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {l__hyp_ocg_view_dict_obj} }
+       \pdfdict_put:nnx { Catalog / OCProperties }{OCGs }{ \pdf_object_ref:n {l__hyp_ocg_print_dict_obj} }
        \pdf_object_write:nx { l__hyp_ocg_config_dict_obj }
          {
            /OFF[\pdf_object_ref:n { l__hyp_ocg_print_dict_obj }]
@@ -550,7 +550,7 @@
              >>
               ]
          }
-       \pdfdict_put:nnn { Catalog / OCProperties }{ D }{ l__hyp_ocg_config_dict_obj }
+       \pdfdict_put:nnx { Catalog / OCProperties }{ D }{ \pdf_object_ref:n { l__hyp_ocg_config_dict_obj} }
     }
     \Hy at AtBeginDocument
       {
@@ -1574,7 +1574,7 @@
         \prop_map_inline:Nn \g__hyp_AcroForm_Fields_prop
           {
             \pdfdict_put:nnx { Catalog / AcroForm } { Fields }{##1}
-            \pdfdict_show:n { Catalog / AcroForm }
+            %\pdfdict_show:n { Catalog / AcroForm }
             \seq_show:c { g__pdf_/Catalog/AcroForm/Fields_seq}
           }
         \prop_if_empty:NF \g__hyp_AcroForm_CoFields_prop
diff --git a/pdfresources.dtx b/pdfresources.dtx
index bb2cf99..26ec239 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -2423,33 +2423,37 @@
 % The following entries are special: Their values are arrays and
 % it must be possible to append to such arrays. This means that a new
 % call to set this value doesn't replace the value but appends it.
-% The value is -- with the exception
-% of AcroForm/Fields and AcroForm/CO -- an object name of an object
-% which must have been declared previously. E.g.
-% % !!!!!!!!
-% %!!!!!!!!!! consider if a reference to a now object isn't better.
+% The value is an object reference. It is sensible to declare the object
+% first. E.g.
 %  \begin{verbatim}
 %  \pdf_object_new:nn   {pkg at intent}{dict}
 %  \pdf_object_write:nn {pkg at intent}{...}
-%  \pdfdict_put:nnn  {Catalog} {OutputIntents}{pkg at intent}
+%  \pdfdict_put:nnx  {Catalog} {OutputIntents}{\pdf_object_ref:n {pkg at intent}}
 %  \end{verbatim}
 %
+%  or
+%  \begin{verbatim}
+%  \pdf_object_now:nn   {dict} { ... }
+%  \pdfdict_put:nnx  {Catalog} {OutputIntents}{\pdf_object_last:}
+%  \end{verbatim}
+%
+%
 %   \medskip
 %   \noindent
 %   \begin{tabularx}{\linewidth}{lll>{\raggedright\arraybackslash}X}
 %    \bfseries Dictionary &\bfseries Name        & \bfseries Value   & \bfseries Remark \\\midrule
 %    Catalog/AcroForm     & Fields               & object reference\\
 %    Catalog/AcroForm     & CO                   & object reference\\
-%    Catalog              & AF                   & object name\\
-%    Catalog/OCProperties & OCGs                 & object name  &if there are OCProperties, OCGs and D are required.\\
-%    Catalog/OCProperties & Configs              & object name \\
-%    Catalog/OCProperties & D                    & object name & This actually a single value as
+%    Catalog              & AF                   & object reference\\
+%    Catalog/OCProperties & OCGs                 & object reference  &if there are OCProperties, OCGs and D are required.\\
+%    Catalog/OCProperties & Configs              & object reference \\
+%    Catalog/OCProperties & D                    & object reference & This actually a single value as
 %                                         there can be only one default.
 %                                         If the value is set twice, the
 %                                         second wins, and the first is
 %                                         added to OCProperties/Configs.\\
-%    Catalog              & OutputIntents        & object name\\
-%    Catalog              & Requirements         & object name & PDF 1.7 \\
+%    Catalog              & OutputIntents        & object reference\\
+%    Catalog              & Requirements         & object reference & PDF 1.7 \\
 %   \end{tabularx}
 %
 %
@@ -2512,7 +2516,9 @@
     OCProperties/OCGs,
     OCProperties/Configs,
     OutputIntents,
-    Requirements
+    Requirements,
+    AcroForm/Fields,
+    AcroForm/CO
   }
 
 
@@ -2522,27 +2528,15 @@
    \seq_new:c { g_@@_dict_/Catalog/#1_seq } % new name later
    \cs_new_protected:cpn { @@_dict_handler/Catalog/#1_gput:n } ##1
      {
-       \seq_gput_right:cx { g_@@_dict_/Catalog/#1_seq } { \pdf_object_ref:n { ##1 } }
+       \seq_gput_right:cn { g_@@_dict_/Catalog/#1_seq } {  ##1  }
      }
  }
 
-%not from a named object
-
-\clist_map_inline:nn { AcroForm/Fields, AcroForm/CO }
-  {
-    \seq_new:c { g_@@_dict_/Catalog/#1_seq } % new name later
-    \cs_new_protected:cpn { @@_dict_handler/Catalog/#1_gput:n } ##1
-      {
-        \seq_gput_right:cx { g_@@_dict_/Catalog/#1_seq } { ##1 }
-      }
- }
-
-
 \cs_new_protected:cpn { @@_dict_handler/Catalog/OCProperties/D_gput:n } #1
   {
-    \seq_gput_left:cx
+    \seq_gput_left:cn
       { g_@@_dict_/Catalog/OCProperties/Configs_seq }
-      { \pdf_object_ref:n { #1 } }
+      {  #1  }
   }
 %    \end{macrocode}
 % \end{macro}
diff --git a/testfiles-dvips/catalogAF.pvt b/testfiles-dvips/catalogAF.pvt
index 3f26b30..d735633 100644
--- a/testfiles-dvips/catalogAF.pvt
+++ b/testfiles-dvips/catalogAF.pvt
@@ -21,8 +21,8 @@
 \pdf_object_new:nn   {filespec2}{dict}
 \pdf_object_write:nn {filespec2} {/Type /Filespec /UF (example2.pdf)}
 
-\pdfdict_put:nnn { Catalog } {AF} {filespec1}
-\pdfdict_put:nnn { Catalog } {AF} {filespec2}
+\pdfdict_put:nnx { Catalog } {AF} {\pdf_object_ref:n {filespec1}}
+\pdfdict_put:nnx { Catalog } {AF} {\pdf_object_ref:n {filespec2}}
 \ExplSyntaxOff
 \begin{document}
 \START
diff --git a/testfiles/catalogAF.pvt b/testfiles/catalogAF.pvt
index 8b8c75a..2254520 100644
--- a/testfiles/catalogAF.pvt
+++ b/testfiles/catalogAF.pvt
@@ -15,8 +15,8 @@
 \pdf_object_new:nn   {filespec2}{dict}
 \pdf_object_write:nn {filespec2} {/Type /Filespec /UF (example2.pdf)}
 
-\pdfdict_put:nnn { Catalog } {AF} {filespec1}
-\pdfdict_put:nnn { Catalog } {AF} {filespec2}
+\pdfdict_put:nnx { Catalog } {AF} {\pdf_object_ref:n {filespec1}}
+\pdfdict_put:nnx { Catalog } {AF} {\pdf_object_ref:n {filespec2}}
 \ExplSyntaxOff
 \begin{document}
 \START
diff --git a/testfiles/ocproperties.pvt b/testfiles/ocproperties.pvt
index bca3c5b..8424ecd 100644
--- a/testfiles/ocproperties.pvt
+++ b/testfiles/ocproperties.pvt
@@ -49,9 +49,9 @@
   /OFF /Blabla
  }
 
-\pdfdict_put:nnn { Catalog / OCProperties } {OCGs}{ocg1}
-\pdfdict_put:nnn { Catalog / OCProperties } {OCGs}{ocg2}
-\pdfdict_put:nnn { Catalog / OCProperties } {D}{ocgd}
+\pdfdict_put:nnx { Catalog / OCProperties } {OCGs}{\pdf_object_ref:n {ocg1}}
+\pdfdict_put:nnx { Catalog / OCProperties } {OCGs}{\pdf_object_ref:n {ocg2}}
+\pdfdict_put:nnx { Catalog / OCProperties } {D}{\pdf_object_ref:n {ocgd}}
 
 \ExplSyntaxOff
 





More information about the latex3-commits mailing list.