dvipdfvm, xdvipdfmx: wrong @xpos and @ypos under rotation

Alexander Grahn A.Grahn at hzdr.de
Thu May 2 23:38:27 CEST 2019


Hello all,

while implementing a command for the creation of PDF destinations for the
[x]dvipdfmx backends, I noticed that @xpos and @ypos are substituted with
wrong coordinate values if they are placed into a box that is subject to
rotation. Both variables are used to mark anchors and rectangles of PDF
destinations.

Rotation becomes relevant if page content is typeset onto landscape pages using
the `landscape' environment provided by the lscape and pdflscape packages.

On the other hand, @xpos and @ypos behave correctly if they are subject to
scaling.

The example code below demonstrates the problem. Would it be possible to fix
it?

Thank you in advance! Kind regards,

Alexander
--

\documentclass{article}             %xelatex
%\documentclass[dvipdfmx]{article}  %latex + dvipdfmx

\usepackage[a4paper]{geometry}
\usepackage{graphicx} % \scalebox \rotatebox

\protected\long\def\pdflink#1#2{%
  \special{pdf:bann<</Type/Annot/Subtype/Link/A<</S/GoTo/D(#1)>>>>}#2%
  \special{pdf:eann}%
} 

\protected\long\def\pdfdestrect#1#2{%
  \leavevmode%
  \begingroup%
    \setbox0=\hbox{#2}%
    \lower\dp0\hbox{%
      \special{pdf:obj @dest@#1 at llx @xpos}%
      \special{pdf:obj @dest@#1 at lly @ypos}%
    }%
    \copy0%
    \raise\ht0\hbox{%
      \special{pdf:dest (#1)
        [@thispage /FitR @dest@#1 at llx @dest@#1 at lly @xpos @ypos]}%
    }%
  \endgroup%
}


\begin{document}
  \pdflink{plain}{\strut Goto `Plain Text'}
  \pdflink{scaled}{\strut Goto `Scaled Text'}
  \pdflink{rotated}{\strut Goto `Rotated Text'}\\[10ex]

  \pdfdestrect{plain}{\fbox{Plain Text}}
  \scalebox{2}{\pdfdestrect{scaled}{\fbox{Scaled Text}}}
  % not working in (x)dvipdfmx
  \rotatebox{90}{\pdfdestrect{rotated}{\fbox{Rotated Text}}}
\end{document}


More information about the tex-live mailing list