[latex3-commits] [git/LaTeX3-latex3-pdfresources] testlinkstuff: added subtype link after driver change (f3e8995)

Ulrike Fischer fischer at troubleshooting-tex.de
Sun May 5 09:12:17 CEST 2019


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

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

commit f3e8995f18b1700b5e1409cd44971a06136add44
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sun May 5 09:12:17 2019 +0200

    added subtype link after driver change


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

f3e8995f18b1700b5e1409cd44971a06136add44
 hluatex-experimental.def |   32 +++++++++++++++++++++++++++++---
 pdfresources.dtx         |   13 +++++++------
 test-pdfresources.tex    |   34 +++++++++++-----------------------
 test-tagpdf-link.tex     |   29 +++++++++++++++++++----------
 4 files changed, 66 insertions(+), 42 deletions(-)

diff --git a/hluatex-experimental.def b/hluatex-experimental.def
index 765dd49..b8e5ef3 100644
--- a/hluatex-experimental.def
+++ b/hluatex-experimental.def
@@ -422,10 +422,21 @@
  }
  % default:
  \driver_pdf_link_margin:n { 1pt}
-\ExplSyntaxOff
-
 
 \providecommand*\@pdfview{XYZ}
+\str_set:Nx\@pdfview{\str_lower_case:f {\@pdfview}}
+
+%redefine to get lowercase pdfview:
+\def\calculate at pdfview#1~#2\\{%
+  \str_set:Nx\@pdfview{\str_lower_case:f {#1}}
+  \ifx\\#2\\%
+    \def\@pdfviewparams{~-32768}%
+  \else
+    \def\@pdfviewparams{~#2}%
+  \fi
+}
+
+\ExplSyntaxOff
 
 \Hy at WrapperDef\new at pdflink#1{%
   \ifhmode
@@ -569,6 +580,7 @@
     \mode_leave_vertical:
     \pdf_link_user:nnn { url }
      {
+       /Subtype /Link
        /A<<
          /Type/Action~
          /S/URI~
@@ -602,6 +614,7 @@
     \pdf_link_user:nnn
      { file }
      {
+       /Subtype /Link
        /A<<
           /F(\Hy at pstringF)
           /S/GoToR
@@ -635,6 +648,7 @@
     \pdf_link_user:nnn
      { run }
      {
+      /Subtype /Link
       /A<<
           /F(\Hy at pstringF)
           /S/Launch
@@ -853,6 +867,7 @@
     \EdefEscapeName\Hy at temp@menu{#1}%
     \pdf_link_user:nnn { menu }
       {
+       /Subtype /Link
        /A<<
           /S/Named
           /N/\Hy at temp@menu
@@ -1062,6 +1077,7 @@
   }{%
   }%
 }
+%\ExplSyntaxOn
 \def\@TextField[#1]#2{% parameters, label
   \def\Fld at name{#2}%
   \let\Fld at default\ltx at empty
@@ -1086,12 +1102,22 @@
       \leavevmode
       \HyAnn at AbsPageLabel
       \Hy at escapeform\PDFForm at Text
+      %\show\PDFForm at Text
       \pdfstartlink user {\PDFForm at Text}\relax
-      \MakeTextField{\Fld at width}{\Fld at height}\pdfendlink
+      %\pdf_link_user:nnn
+%      \driver_pdf_raw_link_begin_user:nnw {}
+%       {widget} %perhaps we need more types??
+%       {\PDFForm at Text}
+       %{
+       \MakeTextField{\Fld at width}{\Fld at height}
+       %}
+       \pdfendlink
+%      \driver_pdf_link_end:
       \HyField at AddToFields
     }%
   \endgroup
 }
+%\ExplSyntaxOff
 \def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
   \def\Fld at name{#2}%
   \let\Fld at default\relax
diff --git a/pdfresources.dtx b/pdfresources.dtx
index f4fa14d..2706985 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -142,7 +142,6 @@
   \pdfcatalog {  } openaction~goto~page #1 {#2}
  }
 
-
 % this needs refinement, probably is should create named objects and add
 % them to the properties, see discussion
 %
@@ -180,6 +179,7 @@
       { \exp_not:N \tex_pdflastlink:D }
   }
 
+
 \cs_new_protected:Npn \driver_pdf_catalog:n #1 %content, currently needed as hyperref has \Hy at PutCatalog
  {
   \pdfextension catalog {#1}
@@ -488,7 +488,10 @@
     }
     #3
    \driver_pdf_link_end:
-   \seq_use:cn { l_@@_hook_link_end_#1_seq }{}
+   \seq_if_exist:cT { l_@@_hook_link_end_#1_seq }
+    {
+     \seq_use:cn { l_@@_hook_link_end_#1_seq }{}
+    }
  }
 %</package>
 %    \end{macrocode}
@@ -540,7 +543,7 @@
 %<*package>
 % perhaps some manipulation of the argument will be needed to map the current
 % hyperref syntax
-
+% unclear currently if is this is useful for anything.
 \prop_new:N \l_@@_views_map_prop
 \prop_put:Nnn \l_@@_views_map_prop {XYZ} { xyz }
 \prop_put:Nnn \l_@@_views_map_prop {xyz} { xyz }
@@ -557,13 +560,11 @@
 \prop_put:Nnn \l_@@_views_map_prop {FitV} { fitv }
 \prop_put:Nnn \l_@@_views_map_prop {fitv} { fitv }
 
-\cs_generate_variant:Nn \driver_pdf_destination:nn {nx}
 \cs_new_protected:Npn \pdf_destination:nn #1 #2
  {
   \prop_if_in:NnTF \l_@@_views_map_prop { #2 }
    {
-    %\exp_args:Nnx\driver_pdf_destination:nn {#1}{\prop_item:Nn\l_@@_views_map_prop{#2}}
-    \driver_pdf_destination:nx { #1 } { \str_lower_case:n { #2 } }
+    \driver_pdf_destination:nn { #1 } {  #2  }
    }
    {
     % should we assume that it is a zoom value then??
diff --git a/test-pdfresources.tex b/test-pdfresources.tex
index 249d5fb..ee887f6 100644
--- a/test-pdfresources.tex
+++ b/test-pdfresources.tex
@@ -19,7 +19,7 @@
 \title{some title}
 \usepackage[customdriver=hluatex-experimental,
             pdfusetitle,
-            pdftrapped=True,
+            %pdftrapped=True,
             pdfversion=1.7,
            % pdfstartpage=3,
            % pdfstartview=
@@ -29,8 +29,7 @@
 
 \usepackage[ocgcolorlinks]{ocgx2}
 
-\hypersetup{pdfview=FitV,pdfinfo={blub=bla,blb=zzz}}
-\usepackage[ocgcolorlinks]{ocgx2}
+\hypersetup{pdfview=FitV 50,pdfinfo={blub=bla,blb=zzz}}
 
 
 \usepackage{bookmark}
@@ -41,30 +40,19 @@
 \makeatletter%\tracingmacros=1
 \textwidth=5cm
 \begin{document}
-\begin{lstlisting}[columns=fixed]
-stream
-   BT
-   /F27 14.3462 Tf                 %select font
-   89.291 746.742 Td               %move point
-   [(1)-574(Intro)-32(duction)]TJ  %print text
-   /F24 10.9091 Tf                 %select font
-    0 -24.35 Td                    %move point
-    [(Let's)-331(start)]TJ         %print text
-    205.635 -605.688 Td            %move point
-    [(1)]TJ                        %print text
-   ET
-endstream
-\end{lstlisting}
-\url{www.xxx.com}
-abc\newpage blb\newpage ccc
-\end{document}
-\tableofcontents
-\section{abc}
+%
+%\url{www.xxx.com}
+%abc\newpage blb\newpage ccc
+%
+%\tableofcontents
+%\section{abc}
 \makeatletter%\show\Hy at pstringdef
 \begin{Form}
 \TextField{abc}
 \TextField{cde}
-abc%\end{document}
+abc
+\end{Form}
+\end{document}
 %
 %\noindent
 %\TextField[name=hight,align=0]{Hight [cm]}
diff --git a/test-tagpdf-link.tex b/test-tagpdf-link.tex
index ff56299..928b897 100644
--- a/test-tagpdf-link.tex
+++ b/test-tagpdf-link.tex
@@ -47,19 +47,19 @@
 \ExplSyntaxOn\makeatletter
 \hook_put_left:nnn
  { pdf }
- { startlink_url }
+ { link_begin_url }
  {
    \uftag_struct_begin:n{tag=Link}
    \uftag_mc_begin:n{tag=Link}\def\blub{abc}
  }
 \hook_put:nnnn
  { pdf }
- { startlink_url_attr }
+ { link_begin_url_attr }
  { /StructParent }
  { \int_use:N\c at g__uftag_parenttree_obj_int }
 \hook_put_right:nnn
  { pdf }
- { endlink_url }
+ { link_end_url }
  {
   \__uftag_struct_finish_link:
    \uftag_mc_end:
@@ -68,31 +68,31 @@
 
 \hook_put:nnnn
  { pdf }
- { startlink_url_attr }
+ { link_begin_url_attr }
  { /Contents }
  { (url) }
 
 \hook_put:nnnn
  { pdf }
- { startlink_link_attr }
+ { link_begin_link_attr }
  { /Contents }
  { (ref) }
 
 \hook_put_left:nnn
  { pdf }
- { startlink_link }
+ { link_begin_link }
  {
    \uftag_struct_begin:n{tag=Link}
    \uftag_mc_begin:n{tag=Link}
  }
 \hook_put:nnnn
  { pdf }
- { startlink_link_attr }
+ { link_begin_link_attr }
  { /StructParent }
  { \int_use:N\c at g__uftag_parenttree_obj_int }
 \hook_put_right:nnn
  { pdf }
- { endlink_link }
+ { link_end_link }
  {
   \__uftag_struct_finish_link:
   \uftag_mc_end:
@@ -103,6 +103,15 @@
 \ExplSyntaxOff
 \begin{document}
 \tagstructbegin{tag=Document}
+\begin{figure}
+\tagstructbegin{tag=Caption}\tagmcbegin{tag=Caption}
+\caption{Schematical description of the relation between marked content in the page stream and the structure}
+\tagmcend\tagstructend
+\end{figure}
+\tagstructend
+\end{document}
+
+
  \leavevmode
  \tagstructbegin{tag=P}
   \tagmcbegin{tag=P}
@@ -121,7 +130,7 @@
 %attention wrong order:
 \tagstructbegin{tag=P}
   \tagmcbegin{tag=P}
-   abc\refstepcounter{section}\label{test}
+   abc\refstepcounter{section}\label{test2}
   \tagmcend
   \tagmcbegin{tag=P}
    abc
@@ -130,7 +139,7 @@
   %\tagmcbegin{tag=P}
    some text
   %\tagmcend
-   \ref{test}
+   \ref{test2}
  \tagstructend %P
 \tagstructend %Document
 





More information about the latex3-commits mailing list