TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am embedding a PDF file inside my LaTeX-generated PDF file using embedfile:


I would like to also insert a link that the user can click on to open the attachment.

Is there any way to do that?

share|improve this question
Related question: How do I make an attached file display like a link?. – Martin Scharrer May 25 '11 at 14:14
up vote 10 down vote accepted

You could use the navigator package instead of embedfile - both packages are quite similar to use (the macro to embed a file is called \embeddedfile instead of \embedfile), but navigator additionally supports the \openfilelink command which creates links to embedded files:

\openfilelink [<appearence options>]{<file name>}[<page number to open>]{<link text>}

A minimal example:

\paragraph{Demonstration:} \openfilelink{myfile.pdf}{Link to the embedded file \texttt{myfile.pdf}}
share|improve this answer
This worked really well. Thanks. Required that I get navigator.tex, yax.tex and texapi.tex, but it was worth it. – vy32 May 26 '11 at 15:26
Doesn't work for me on TeXLive2012, XeTeX. – Adobe Apr 29 '13 at 10:45
@Adobe The MWE above works fine for me with XeLaTeX (using TeX Live 2012). Do you get any error messages when trying to compile the document? – diabonas Apr 29 '13 at 14:36
@diabonas: Thanks. I tried again: doesn't produce any error messages. Doesn't work in okular and evince. But works in Adobe Reader after 2 clicks. – Adobe May 7 '13 at 7:00

If you want a link, use the package attachfile instead of embedfile. The default behavior of a file attached with \attachfile{filename} is to display an icon, but \textattachfile{filename}{<text>} will turn <text> into a link to your embedded file.

attachfile works well, I've been using it for years.


Regarding your trouble with a printout: The manual of attachfile tells you that the boolean option print=true will never print, unless you tell your pdf-viewer to do that -- and most of them, including Acrobat, won't, anyway what you do. You asked for clickable links, not for printouts. . .

But of course it is possible to have all the text printed on paper, e.g. like that:

\usepackage{calc, attachfile}

\textattachfile[color=0 0 0]{#1}{#2}\doubleprint{#2}\hspace{-\Urlname}#2}



Instead of \textattachfile{}{} use the \textattachfileandprintout or define a shorter command!

Regards, Alexander

share|improve this answer
Argh! Two problems with attachfile. Problem #1 - the text is yellow with Acrobat Viewer. Problem #2 - the text is invisible on Apple's Preview. Any thoughts? – vy32 May 26 '11 at 1:38
@vy32 To solve your first problem, you can say \textattachfile[color=0 0 0]{filename}{<text>} to change the text color to black. – diabonas May 26 '11 at 9:50
The best solution has been suggested here: tex.stackexchange.com/questions/17926/… – Keks Dose May 27 '11 at 6:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.