[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: pageobject_ref (3b3bc6e)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun Aug 18 17:05:03 CEST 2019


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

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

commit 3b3bc6e89890a48d675b1ec714aa755d2aea7f32
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun Aug 18 17:05:03 2019 +0200

    pageobject_ref


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

3b3bc6e89890a48d675b1ec714aa755d2aea7f32
 experiments/catalogue.tex | 11 ++++++-----
 pdfresources.dtx          | 24 +++++++++++++++++-------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/experiments/catalogue.tex b/experiments/catalogue.tex
index 51aa1ce..3516053 100644
--- a/experiments/catalogue.tex
+++ b/experiments/catalogue.tex
@@ -17,7 +17,7 @@
  \pdfcatalog{/Lang~(en-UK)}
  % not good there should be only one ...
  %\pdfcatalog{/Lang (de-DE)}
- \pdfcatalog{/OpenAction~[\pdfpageref 2~0~R~/FitH]}
+ \pdfcatalog{/OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]}
 }
 xxx
 %\special{pdf: docview << /PageMode /UseThumbs >> }
@@ -31,7 +31,7 @@ xxx
 %\special{pdf:put @catalog << /PageLayout /TwoColumnRight >> }
 %\special{pdf:put @catalog << /PageMode /UseThumbs >> }
 %\special{pdf:docview <</OpenAction[@page2 /FitH]>>}
-\special{pdf:put @catalog <</OpenAction[@page2 /FitH]>>}
+\special{pdf:put @catalog <</OpenAction[\pdf_pageobject_ref:n {2}~/FitH]>>}
 }
 
 \bool_if:nT {\sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p: }
@@ -41,13 +41,13 @@ xxx
   \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~[{Page2}~/FitH]>>~/PUT~pdfmark~end}
+  \special{ps:~SDict~begin~mark~{Catalog}~<</OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]>>~/PUT~pdfmark~end}
 %\pbs_special:n{~mark~{Catalog}~<<#1>>~/PUT~pdfmark}
 }
 
 \bool_if:NT {\sys_if_engine_luatex_p:}
 {
-\pdfextension catalog {  } openaction~goto~page 2 {/FitH}
+\pdfextension catalog {/OpenAction~[\pdf_pageobject_ref:n {2}~/FitH]} %openaction~goto~page 2 {/FitH}
 }
 \newpage blb
 \newpage blbl
@@ -76,7 +76,8 @@ Catalog/PageMode                 name (/UseNone, /UseOutlines, /UseThumbs, /Full
                 /Q               : Integer
                 /XFA             : stream or array
 
-single but has perhaps a specific interface:
+single but should perhaps get
+ 
        /OpenAction               (array (dest) or dictionary (action))
 
 multiple values
diff --git a/pdfresources.dtx b/pdfresources.dtx
index e1e360c..3d3ed6a 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -154,40 +154,50 @@
 %</package>
 %    \end{macrocode}
 % \subsection{references to page objects}
+% \begin{function}[added = 2019-08-18]
+%   {\pdf_pageobject_ref:n}
+%   \begin{syntax}
+%     \cs{pdf_pageobject_ref:n} \Arg{number}
+%   \end{syntax}
+%   This returns the object reference of a page object. The number is the absolute
+%   page number. The count starts with one.
+% \end{function}
 %    \begin{macrocode}
 %<*package>
 \bool_if:nT {\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p:}
 {
- \cs_new:Npn \@@_backend_pageobj_ref:n #1
+ \cs_new:Npn \@@_backend_pageobject_ref:n #1
   {
-    \tex_pdfpageref:D #1 ~ 0 ~ R
+    \tex_pdfpageref:D #1 ~ \c_space_tl 0 ~ R
   }
 }
 %luatex
 \sys_if_engine_luatex:T
  {
-  \cs_new:Npn \@@_backend_pageobj_ref:n #1
+  \cs_new:Npn \@@_backend_pageobject_ref:n #1
    {
-     \tex_pdffeedback:D~pageref #1 ~ 0 ~ R
+     \tex_pdffeedback:D~pageref #1 ~ \c_space_tl 0 ~ R
    }
  }
 %dvips
 \bool_if:nT {\sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p: }
 {
- \cs_new:Npx \@@_backend_pageobj_ref:n #1
+ \cs_new:Npn \@@_backend_pageobject_ref:n #1
   {
-    \token_to_str:N {Page#1 \token_to_str:N}
+    {Page#1}
   }
 }
 
 %xetex
 \sys_if_engine_xetex:T
  {
-  \cs_new:Npn \@@_backend_pageobj_ref:n #1
+  \cs_new:Npn \@@_backend_pageobject_ref:n #1
    {
      @page#1
    }
  }
+
+\cs_set_eq:NN \pdf_pageobject_ref:n \@@_backend_pageobject_ref:n
 %</package>
 %    \end{macrocode}
 % \subsection{Shipoutcode}





More information about the latex3-commits mailing list