I use the embedfile package in order to embed the LaTeX source code into the final PDF with the following code:



The document

This works fine with pdflatex, but now I have to switch to XeLaTeX in order to use a custom TrueType font. However, the embedfile package doesn't support the program dvipdfmx used by XeLaTeX. Is there a way to modify the package to make it cooperate with dvipdfmx, or another package with similar functionality supporting this driver?

(This question is similar, but not identical, to Attach files to PDF with dvipdfmx: In the answers to this question, a way to attach a file to a PDF using dvipdfmx is shown. This creates a visible icon in the document, which is not what I want: The embedded file should only appear in the list of attachments displayed e.g. by Acrobat Reader.)

2 Answers 2


OK, I figured it out myself: The package navigator works fine with pdflatex and dvipdfmx and supports embedding files through the \embeddedfile macro:



The document

The syntax of the command is

\embeddedfile[<optional description>]{<object name>}[<optional filename displayed in the viewer>]{<file>}

Heiko Oberdiek has updated attachfile2 package to support dvipdfmx and XeTeX. Use this version:


(The attachfile2.dtx is attached in the pdf file.)

To avoid the icon, you can use \textattachfile command. For example:

\textattachfile{foo.jpg}{} % no icon or text
  • Thanks for your answer! Unfortunately, I couldn't find a way to embed a file using this package without creating a visible icon in the document as described in my question. However, I came across the navigator package, which implements exactly what I need - see my own answer.
    – diabonas
    Feb 5, 2011 at 13:29
  • 2
    @diabonas: \textattachfile{filename}{} should work.
    – Leo Liu
    Feb 5, 2011 at 13:33
  • 1
    On 2011-04-12, the latest attachfile2 version was uploaded to CTAN, so you can now install the version supporting dvipdfmx by simply updating your TeX distribution. The temporary download link mentioned above doesn't exist any more.
    – diabonas
    May 26, 2011 at 16:51
  • Giving an example would probably help; the link is dead.
    – Clément
    Aug 24, 2015 at 20:57

You must log in to answer this question.

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