[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: working on viewerpreferences (2a8f90f)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu May 23 00:28:10 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : testlinkstuff
Link       : https://github.com/latex3/pdfresources/commit/2a8f90fb4caa228b76e7879a6bb4bb10f2148c27

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

commit 2a8f90fb4caa228b76e7879a6bb4bb10f2148c27
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu May 23 00:28:10 2019 +0200

    working on viewerpreferences


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

2a8f90fb4caa228b76e7879a6bb4bb10f2148c27
 hluatex-experimental.def |    8 ++++++--
 pdfresources.dtx         |   37 +++++++++++++++++++++++++++++++++----
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 1ad3653..2b6b2c3 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -720,8 +720,12 @@
      \pdf_docview:nn {\@pdfstartpage} {\@pdfstartview}
    }
   \edef\Hy at temp{%
-    \ifHy at pdftoolbar\else /HideToolbar\c_space_tl true\fi
-    \ifHy at pdfmenubar\else /HideMenubar\c_space_tl true\fi
+    \ifHy at pdftoolbar\else
+     \pdf_catalog_ViewerPreferences_gput:nn{HideToolbar}{true}
+    \fi
+    \ifHy at pdfmenubar\else
+     \pdf_catalog_ViewerPreferences_gput:nn{HideMenubar}{true}
+    \fi
     \ifHy at pdfwindowui\else /HideWindowUI\c_space_tl true\fi
     \ifHy at pdffitwindow /FitWindow\c_space_tl true\fi
     \ifHy at pdfcenterwindow /CenterWindow\c_space_tl true\fi
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 56aff5e..3d1302d 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -766,6 +766,8 @@
 %   the package doing the tagging should create this.
 %  \item[Lang] (string, e.g. (de-DE))
 %  \item[NeedsRendering] (boolean, pdf 1.7)
+%  \item[PageLabels] dictionary containing on /Nums + array entry describing the numbering system of the pages.
+%  (done by hyperref).
 % \end{description}
 %    \begin{macrocode}
 %<*package>
@@ -777,14 +779,40 @@
  }
 %</package>
 %    \end{macrocode}
-%%% open: Collection, OCProperties, AcroForm, Metadata, ViewerPreferences, PageLabels, Names,
+%%% open: Collection,  AcroForm, Metadata, ViewerPreferences, Names,
 %% Dests, AF (array of dictionaries, pdf 2.0, associated files, important for accessibility),
 %% Threads, AA (dict, additional-actions),
 %% open not so important:SpiderInfo (dict), PieceInfo (dict), (dict, pdf 1.5, permissions), Legal (dict, pdf 1.5)
 %% Requirements (array, pdf 1.7), Extensions (dict, pdf 2.0), DSS (dict, pdf 2.0),
 %% DPartRoot, (dict, pdf 2.0)
-%% resolved: OutputIntents
+%% resolved: OutputIntents, OCProperties,
 % \subsubsection{catalog, special cases}
+% \paragraph{ViewerPreferences}
+% This is a dictionary with various entries. So we setup a prop that can be filled and is pushed to
+% the catalog / an object later.
+%    \begin{macrocode}
+%<*package>
+\prop_new:N\g_@@_catalog_ViewerPreferences_prop
+\cs_new_protected:Npn \pdf_catalog_ViewerPreferences_gput:nn #1 #2
+ {
+  \prop_gput:Nnn \g_@@_catalog_ViewerPreferences_prop {#1}{#2}
+ }
+
+\cs_new_protected:Npn\@@_catalog_ViewerPreferences_gpush:
+ {
+  \prop_if_empty:NF\g_@@_catalog_ViewerPreferences_prop
+   {
+    \driver_pdf_object_new:nn   {g_@@_catalog_ViewerPreferences_obj} {dict}
+    \driver_pdf_object_write:nx   {g_@@_catalog_ViewerPreferences_obj}
+    {
+     \prop_map_function:NN \g_@@_catalog_ViewerPreferences_prop \driver_pdf_dict_item:nn
+    }
+    \driver_pdf_catalog_gput:nn {ViewerPreferences}{\driver_pdf_object_ref:n {g_@@_catalog_ViewerPreferences_obj}}
+   }
+ }
+
+%</package>
+%    \end{macrocode}
 % \paragraph{OCProperties}
 %  This is a dictionary with three entries:
 %  \begin{description}
@@ -864,8 +892,9 @@
 %<*package>
 \AtBeginDocument %need to be decided ...
  {
-  \@@_catalog_array_gpush:n {OutputIntents}
-  \@@_catalog_OCProperties_gpush:
+  \@@_catalog_array_gpush:n {OutputIntents} %OutputIntents
+  \@@_catalog_OCProperties_gpush:           %OCProperties
+  \@@_catalog_ViewerPreferences_gpush:      %ViewerPreferences
   \prop_map_function:NN  \g_@@_catalog_prop \driver_pdf_catalog_gput:nn
  }
 %</package>





More information about the latex3-commits mailing list