我想像或\attachfile
一样将文件附加到 PDF 文档\textattachfile
,但我希望重命名附加的文件。据我所知,attachfile
和软件包attachfile2
不提供此功能。
使用这些包embedfile
,navigator
我可以嵌入文件并选择新名称进行存储。但我希望像上面\attachfile
那样在文本中添加注释。是否有两者的有效组合或一些原始 PDF 向导来访问嵌入的文件?
以下是 MWE:
\begin{filecontents*}{foo.bar}
\documentclass{article}
\begin{document}
Foo.
\end{document}
\end{filecontents*}
%
\documentclass{article}
\usepackage{xcolor}
\usepackage[color=red]{attachfile2}
\usepackage{embedfile}
\begin{document}
\begin{enumerate}
\item Attachment of the file 'foo.bar':
\textattachfile{foo.bar}{Embedded file with original name}
\item Embedding of 'foo.bar' as 'usefulname.tex'.
\embedfile[ucfilespec={usefulname.tex}]{foo.bar}
\item How to attach 'foo.bar' as 'usefulname.tex' and get an
annotation on the page as in the first case?
\end{enumerate}
\end{document}
答案1
文档中attachfile2
提到了这个选项ucfilespec
,它对我有用,但前提是我没有包含原始名称的文件:
\begin{filecontents*}{foo.bar}
\documentclass{article}
\begin{document}
Foo.
\end{document}
\end{filecontents*}
%
\documentclass{article}
\usepackage{xcolor}
\usepackage[color=red]{attachfile2}
\usepackage{embedfile}
\begin{document}
\begin{enumerate}
\item Attachment of the file 'foo.bar':
% \textattachfile{foo.bar}{Embedded file with original name}
\item Embedding of 'foo.bar' as 'usefulname.tex'.
\embedfile[ucfilespec={usefulname.tex}]{foo.bar}
\item How to attach 'foo.bar' as 'usefulname.tex' and get an
annotation on the page as in the first case?
\textattachfile[ucfilespec={usefulname2.tex}]{foo.bar}{Embedded file with changed name}
\end{enumerate}
\end{document}