How to preserve hyperlinks in included PDF?
You can not simply mix two PDF files. You have to preserve PDF document structure. In the simply case links (PDF annotations) are dropped.
You can try the PAX project, which trys to extract and reinsert the PDF annotations.
It seems that pdftex always drops all PDF annotations (which includes hyperlinks) from the included file.
The PDF format itself makes it rather difficult to do otherwise. PDF annotations are laid out in a completely different way to how the rest of the content of the page is constructed. They live on a different layer and they are positioned using a different (page-absolute) coordinate system.
It works with luatex. However, it is not considered to be stable. Here a context example:
\setupinteraction [state=start] \starttext \startbuffer [internal] \setupinteraction [state=start] \starttext \useURL [aurl] [http://xkcd.com/149/] [] [I prefer hot dogs.] \from [aurl] \stoptext \stopbuffer \savebuffer [internal] \executesystemcommand {context --purgeall \jobname-internal.tmp} \externalfigure [\jobname-internal] [scale=500, interaction=yes] \stoptext
Explanation:
- The buffer contains the code for a PDF file with a hyperlink.
- The
\savebuffer
writes the content of the buffer internal in an external file. \executesystemcommand
runs context on this file to create the PDF file containing the link.- Eventually the
externalfigure
command includes the just created PDF in the current document.
Tested with luatex beta-0.70.1-2011051923 and context 2011.11.04 14:15