12.14.1 \AtBeginDvi & \AtEndDvi



\AtBeginDvi saves, in a box register, code to be executed at the beginning of the shipout of the first page of the document. Despite the name, it applies to DVI, PDF, and XDV output. It fills the shipout/firstpage hook; new code should use that hook directly.

Similarly, \AtEndDvi (previously available only with the atenddvi package) is code executed when finalizing the main output document.

Unofficial LaTeX2e reference manual