[dvipdfmx] pdf:dest and destination name translation

Alexander Grahn A.Grahn at web.de
Mon May 13 17:12:07 CEST 2019


Dear Shunsaku,

When creating a PDF destination, dvipdfmx translates a user-provided
destination name given in the special

  \special{pdf:dest (destination name) [...]}

to an internal representation, which is a sequential integer, wrapped into a
PDF string: (some dest) becomes (0), (another dest) becomes (1) and so on.

This is unfortunate. While translation works for Link GoTo actions, dvipdfmx
fails to translate the destination name in other GoTo Action dictionaries, for
example, if a GoTo action is associated with the Mouse-Up trigger of a Button
Widget. Here, an invalid GoTo action is written to the PDF.

Original dvipdfm and older dvipdfmx versions did not translate user-provided
destination name strings, but used them verbatim. Could the original behaviour
please be restored?

Please find an example code at the bottom of this message.

Thank you and kind regards,

Alexander
--

\documentclass{article}

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

%Push Button
\newcount\widcnt
\makeatletter
\protected\def\pdfwidget#1#2{%
  \begingroup%
  \sbox{0}{#2}%
  \special{pdf:ann @wdgt\the\widcnt\space
    width \strip at pt\wd0pt
    height \strip at pt\ht0pt
    depth \strip at pt\dp0pt <<
      /Subtype/Widget/FT/Btn/Ff 65536/H/I
      /T (wdgt\the\widcnt)
      /AA<<
        /U << /S/GoTo/D (#1) >> %mouse-Up action
      >>
    >>
  }%
  \special{pdf:put @fields @wdgt\the\widcnt}%
  \global\advance\widcnt 1%
  \usebox{0}%
  \endgroup%
}
\makeatother
\special{pdf:obj @fields []}
\special{pdf:put @catalog <</AcroForm <</Fields @fields >>>>}

%PDF Destination
\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{myDest}{\strut Link}     % works:        (myDest) --> (0)
  \pdfwidget{myDest}{\fbox{Button}} % not ok:       (myDest) --> (myDest)

  \pdfdestrect{myDest}{\fbox{\Huge Hello World!}} % (myDest) --> (0)
\end{document}


More information about the dvipdfmx mailing list