3

I'm interested in having a PDF bookmark pointing to an attached file in the PDF. At least I know it is possible to have bookmarks pointing to an URL. See for instance the hyperref manual. You can see that the last bookmarks are pointing to other PDF in the Internet.

If it is not possible to have a bookmark pointing to an attached file in the PDF file, how did they manage to have a bookmark pointing to an URL?

2
  • Package bookmark supports URL actions, see option uri. Commented May 5, 2014 at 22:31
  • Thank you guys so much!! :) Both answers were really helpful! It totally worked! I should have found this site while completing my MSc Thesis a few years ago...
    – Pedro
    Commented May 6, 2014 at 15:12

2 Answers 2

5

Package hypgotoe add support for embedded go-to actions (GoToE) to \href. This action type only works from and to PDF files. The package only supports destination names as link targets. For example they can be set via \hypertarget or extracted by package zref-xr or xr-hyper.

More arbitrary bookmarks can be generated via package bookmark. Currently it does not support GoToE actions, but it has an options rawaction, that allows to specify the raw PDF action dictionary for unsupported actions.

Example file:

\documentclass{article}
\usepackage{embedfile}
\usepackage{hyperref}
\usepackage{hypgotoe}
\usepackage{bookmark}

\begin{document}
\section{Hello World}
\embedfile{t.pdf}

\href{gotoe:embedded=t.pdf,dest=page.2}{Page 2 of \texttt{t.pdf}}

\bookmark[   
  rawaction={
    /S /GoToE    % action type
    /D (page.2)  % destination name
    /D [0 /FitH 750] %
    /T <<
      /R /C      % relation: child
      /N (t.pdf) % name of embedded file
    >>
  },
]{Embedded file t.pdf, page 2}

\bookmark[   
  rawaction={
    /S /GoToE    % action type
    /D [0 /FitH 700] % go to first page,
                     % view: fit width at 750bp from the bottom
    /T <<
      /R /C      % relation: child
      /N (t.pdf) % name of embedded file
    >>
  },
]{Embedded file t.pdf, page 1}

\end{document}

t.pdf was generated from

\documentclass{article}
\usepackage{hyperref}
\begin{document}
\section{Embedded file}
\newpage
Page two of embedded file.
\end{document}
4

bookmark's uri key-value supports hyperlinking to external content:

enter image description here

\documentclass{article}
\usepackage{bookmark,xcolor}

\begin{document}

\tableofcontents

\section{A section}
\subsection{A subsection}
\bookmark[uri={http://tex.stackexchange.com},color=blue,startatroot]{TeX.SE}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .