LaTeX offers \AtBeginDvi. This package provides the counterpart \AtEndDvi. The execution of its argument is delayed to the end of the document at the end of the last page. At this point \special and \write remain effective, because they are put into the last page. This is the main difference from the LaTeX command \AtEndDocument.
The package is part of the oberdiek bundle.
The author is Heiko Oberdiek. The package is Copyright © 2007 Heiko Oberdiek.
License: lppl1.3 Version: 1.1 Catalogued: 2012-05-08