Attach File Inside PDF

Chester Wyke August 15, 2023 Updated: April 15, 2025 #latex

Source: https://tex.stackexchange.com/questions/18271/include-binary-data

This allows you to include (embed) a file in the output PDF like an attachment. It is easy enough to get the base functionality. You just add a use statement

\usepackage{attachfile}

then just add the attach command (in the example the file is called a.tar.xz)

\attachfile{a.tar.xz}

To get the file back out of the PDF I have found mixed support in readers but Firefox allows you to double click on the icon that is generated and opens a download dialog.