[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: working on catalog (ad9fba9)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Aug 18 23:59:27 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/ad9fba98f7b687ae24e734cc207575a714744189

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

commit ad9fba98f7b687ae24e734cc207575a714744189
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Aug 18 23:59:27 2019 +0200

    working on catalog


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

ad9fba98f7b687ae24e734cc207575a714744189
 experiments/catalogue.tex | 50 ++++++++++++++++++++++++++++++++++-------------
 pdfresources.dtx          | 43 ++++++++++++++++++++++++++++------------
 2 files changed, 67 insertions(+), 26 deletions(-)

diff --git a/experiments/catalogue.tex b/experiments/catalogue.tex
index 3516053..e71d920 100644
--- a/experiments/catalogue.tex
+++ b/experiments/catalogue.tex
@@ -14,40 +14,60 @@
 
 \bool_if:nT {\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p: }
 {
- \pdfcatalog{/Lang~(en-UK)}
+ \__pdf_backend_catalog_gput:nn {Lang}{(en-UK)}
+ %\pdfcatalog{/Lang~(en-UK)}
  % not good there should be only one ...
  %\pdfcatalog{/Lang (de-DE)}
- \pdfcatalog{/OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]}
+ \exp_args:Nnx 
+ \__pdf_backend_catalog_gput:nn {Openaction}{[\pdf_pageobject_ref:n {2}~/FitH]}
+ 
+ %\pdfcatalog{/OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]}
 }
 xxx
 %\special{pdf: docview << /PageMode /UseThumbs >> }
 \sys_if_engine_xetex:T
 {
-\special{pdf:put @catalog << /PageLayout /SinglePage >> }
+%\special{pdf:put @catalog << /PageLayout /SinglePage >> }
+\__pdf_backend_catalog_gput:nn {PageLayout}{/SinglePage}
 %not a problem, the second wins:
-\special{pdf:put @catalog << /Lang~(en-UK)>> }
-\special{pdf:put @catalog << /Lang~(de-DE)>> }
+%\special{pdf:put @catalog << /Lang~(en-UK)>> }
+ \__pdf_backend_catalog_gput:nn {Lang}{(en-UK)}
+%\special{pdf:put @catalog << /Lang~(de-DE)>> }
+ \__pdf_backend_catalog_gput:nn {Lang}{(de-DE)}
 %\special{pdf:put @catalog << /PageLayout /SinglePage >> }
 %\special{pdf:put @catalog << /PageLayout /TwoColumnRight >> }
 %\special{pdf:put @catalog << /PageMode /UseThumbs >> }
 %\special{pdf:docview <</OpenAction[@page2 /FitH]>>}
-\special{pdf:put @catalog <</OpenAction[\pdf_pageobject_ref:n {2}~/FitH]>>}
+%\special{pdf:put @catalog <</OpenAction[\pdf_pageobject_ref:n {2}~/FitH]>>}
+\exp_args:Nnx 
+\__pdf_backend_catalog_gput:nn {OpenAction}{[\pdf_pageobject_ref:n {2}~/FitH]}
 }
 
 \bool_if:nT {\sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p: }
 {
-  \special{ps:~SDict~begin~mark~{Catalog}~<</PageLayout /SinglePage>>~/PUT~pdfmark~end}
-  \special{ps:~SDict~begin~mark~{Catalog}~<</PageLayout /TwoColumnRight>>~/PUT~pdfmark~end}
-  \special{ps:~SDict~begin~mark~{Catalog}~<</PageMode  /UseThumbs>>~/PUT~pdfmark~end}
-  \special{ps:~SDict~begin~mark~{Catalog}~<</Lang~(en-UK)>>~/PUT~pdfmark~end}
-  \special{ps:~SDict~begin~mark~{Catalog}~<</Lang~(de-DE)>>~/PUT~pdfmark~end}
-  \special{ps:~SDict~begin~mark~{Catalog}~<</OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]>>~/PUT~pdfmark~end}
+  %\special{ps:~SDict~begin~mark~{Catalog}~<</PageLayout /SinglePage>>~/PUT~pdfmark~end}
+  \__pdf_backend_catalog_gput:nn {PageLayout}{/SinglePage}
+  \__pdf_backend_catalog_gput:nn {Lang}{(en-UK)}
+  %\special{ps:~SDict~begin~mark~{Catalog}~<</PageLayout /TwoColumnRight>>~/PUT~pdfmark~end}
+  %\special{ps:~SDict~begin~mark~{Catalog}~<</PageMode  /UseThumbs>>~/PUT~pdfmark~end}
+  %\special{ps:~SDict~begin~mark~{Catalog}~<</Lang~(en-UK)>>~/PUT~pdfmark~end}
+  %\special{ps:~SDict~begin~mark~{Catalog}~<</Lang~(de-DE)>>~/PUT~pdfmark~end}
+  %\special{ps:~SDict~begin~mark~{Catalog}~<</OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]>>~/PUT~pdfmark~end}
+  \exp_args:Nnx
+\__pdf_backend_catalog_gput:nn {OpenAction}{[\pdf_pageobject_ref:n {2}~/FitH]}
 %\pbs_special:n{~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
 }
 
 \bool_if:NT {\sys_if_engine_luatex_p:}
 {
-\pdfextension catalog {/OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]} %openaction~goto~page 2 {/FitH}
+%\pdfextension catalog {/OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]} %openaction~goto~page 2 {/FitH}
+\__pdf_backend_catalog_gput:nn {Lang}{(en-UK)}
+ %\pdfcatalog{/Lang~(en-UK)}
+ % not good there should be only one ...
+ %\pdfcatalog{/Lang (de-DE)}
+ \exp_args:Nnx
+ \__pdf_backend_catalog_gput:nn {Openaction}{[\pdf_pageobject_ref:n {2}~/FitH]}
+ 
 }
 \newpage blb
 \newpage blbl
@@ -70,13 +90,15 @@ Catalog/PageMode                 name (/UseNone, /UseOutlines, /UseThumbs, /Full
        /Threads                  (objref to array)
        /DPartRoot                (dict, pdf 2.0)
        /PageLabels               (number tree /indirect object)
+       /Version                   name, eg. /1.7
        /AcroForm/NeedAppearances : boolean, single
                 /SigFlags        : Integer
                 /DA              : String
                 /Q               : Integer
                 /XFA             : stream or array
 
-single but should perhaps get
+single but should perhaps get an additional user command ...
+goto page can be done with the argument "[\pdf_pageobj_ref:n{2}~/FitH]"
 
        /OpenAction               (array (dest) or dictionary (action))
 
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 3d3ed6a..235fd1d 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -1494,6 +1494,37 @@
 
 %</package>
 %    \end{macrocode}
+% \subsection{Catalog}
+% \subsubsection{Catalog / backend}
+% the backend command is already in the driver:
+% \verb+\__pdf_backend_catalog_gput:nn+
+% \subsubsection{ Catalog / management }
+% \begin{NOTE}{UF}
+% The catalog dictionary is filled by e.g. \cs{pdfcatalog}. Multiple appearances of
+% \cs{pdfcatalog} are concatenated, so one could end with multiple entries for the same value
+% with luatex and pdftex -- the other backends normally avoid this problem.
+% We therefore setup a property which is filled and executed at a sensible (not yet found) place.
+% \cs{pdfcatalog} has an option \texttt{openaction} to set the start view options.
+% This is ignored here but set in a separate command (to be in sync with other drivers).
+% /AF is even an array of dictionaries.
+% There is probably no way to test what has already been added to the catalog,
+% so doublettes can only be avoided with ``don't do it''.
+% % \end{NOTE}
+% The entries in the catalog have varying requirements regarding the
+% pdf management. Some entries (like /Lang) are simple values where the last setting should
+% win, other like /OutputIntents are dictionaries which can be filled from more than
+% one source. In some cases the values that needs to be added are not at the toplevel
+% but in some subsubdictionary. To handle this some \Arg{keys} in the following command
+% are connected with special functions.
+% \begin{function}[added = 2019-08-18]
+%   {\pdf_catalog_gput:nn}
+%   \begin{syntax}
+%     \cs{pdf_catalog_gput:nn} \Arg{key} \Arg {value}
+%   \end{syntax}
+%   This adds an entry to the catalog. \Arg{key} should be one of the following,
+%   the exact Format of \Arg{value} depends on \Arg{key}.
+% \end{function}
+
 %=================================================================
 % \subsection{other stuff}
 % \subsubsection{Openaction}
@@ -1687,18 +1718,6 @@
 %</package>
 %    \end{macrocode}
 % \subsection{The catalog}
-% The catalog dictionary is filled by e.g. \cs{pdfcatalog}. Multiple appearances of
-% \cs{pdfcatalog} are concatenated, so one could end with multiple entries.
-% We is better to avoid this. We therefore setup a
-% property which is filled and executed in one at a sensible (not yet found) place.
-% \cs{pdfcatalog} has an option \texttt{openaction} to set the start view options.
-% This is ignored here but set in a separate command (to be in sync with other drivers).
-% The entries in the catalog have varying requirements regarding the
-% pdf management. Some entries (like /Lang) are simple values where the last setting can
-% simply win, other like /OutputIntents are dictionaries which can be filled from more than
-% one source. /AF is even an array of dictionaries.
-% There is probably no way to test what has already been added to the catalog,
-% so doublettes can only be avoided with ``don't do it''.
 % \subsubsection{Simple values}
 % \enquote{Simple} values are values that can be sensibly set only once. When set a second time
 % the new value overwrites the first value. The value itself can be something simple like





More information about the latex3-commits mailing list