2

I am looking for some trick to do a system call after the document is finalized. The idea is that the finished document is copied or converted or emailed or whatever without a shell script or batch file.

The following MWE explains what I try to do:

\documentclass{article}
\usepackage{etoolbox}

% just an example for a system call
\newcommand{\mycall}{%
  \immediate\write18{copy /Y \jobname.pdf dummy.pdf}
}

\AfterEndDocument{\mycall}

\begin{document}
Hello World.
\end{document}

I know that this MWE gives not the desired result because \AfterEndDocument is still too early. I would like to place \mycall after the final shipout, if possible.

I also know a workaround, i.e. writing the document content in a separate file and compile that file (the TikZ externalize approach), but is it possible to do such a call from within the original document? Any ideas?

0 Answers0