[Tex/LaTex] \AddEverypageHook at end of page

page-breaking

\AddEverypageHook works at the start of a page. How can I add a hook to the every last part of a page right before a pagebreak?

Essentially I want to watermark the pages BUT I want to do it after the page contents have been created but immediately before the pagebreak. The "watermark"(not a watermark but just similar concept) will depend on macro values set(like \thepage) so it can't happen at the very end of the document.

Best Answer

Have you checked out Martin Schroder's everyshi package? Quoting from the introductory section of the package's user guide:

This package provides the hooks \EveryShipout and \AtNextShipout whose arguments are executed after the output routine has constructed \box255, and before \shipout is called.

An example application for this package would be a package for adding text to the bottom of each page. Such a package does exist: prelim2e.

Another application is a package for adding pictures to every page: esopic.

Related Question