If one and the same image is included in a PDF multiple times it is only stored only once as an PDF object. Now I like to also attach an image which is shown in the document to the PDF to allow users to copy the file. I'm aware that it is sometimes possible to copy images from the PDF anyway, but AFAIK this is limited to raster images like PNG and JPG, and not possible for included PDF images/diagrams.
I'm aware of the packages like embedfile
and attachfile
, but the tricky part is: Is it possible to display and attach/embed an already used image as PDF attachment without having it stored twice in the PDF?
Or in other words, the other way around: I like to add an image file as PDF attachment and then display this image file also in the document, without storing it again. AFAIK the PDF format should support this, but exactly how is the question. I don't mind a solution which uses some \pdfobj
code.
Here a minimal example so that people can understand it better:
\documentclass{article}
\usepackage{graphicx}
\usepackage{embedfile}
\begin{document}
% Used twice, but only stored once:
\includegraphics[width=\textwidth]{tiger.pdf}
\includegraphics[width=\textwidth,angle=45]{tiger.pdf}
% Also added as attachment:
\embedfile{tiger.pdf}
% This should reuse the image file above, but adds `tiger.pdf` a second time
\end{document}
hypgotoe
package can be useful. It seems to allow you to attach the file once, but then link to it from multiple places in the PDF.