This question is similar to the unanswered How to put something on a page without disturbing the main vertical list? but (very slightly) more tightly defined.
I want to put a picture in the background of a page using eso-pic and \AddToShipoutPictureBG*.
Now, by default this page won't be output unless there is actually something on it.
I want it to show up when the page is empty and when the page contains content, but without knowing beforehand which case is wanted.
I can't just insert \null because this messes with the main vertical list and things like \section will then be at the wrong place at the top of the page.
Is there anything I can do or any work around?
MWE
\documentclass{article}
\usepackage{eso-pic}
\usepackage{graphicx}
\begin{document}
\AddToShipoutPictureBG*{%
\AtPageCenter{%
\makebox(0,0){\includegraphics{example-image.pdf}}}}
% <- insert something that doesn't mess with vertical spacing but causes the
% page to be output.
% <- possible further content (e.g., \section{...}) or possibly no content.
\end{document}
\sectionor other code, I did not test it that way. – Apr 18 '18 at 14:52\sectionin the comments. (And to be fair, I mentioned\nullin the question.) – David Purton Apr 18 '18 at 14:57\ifvmode\leavevmode\fi– touhami Apr 18 '18 at 19:39\section. – David Purton Apr 19 '18 at 03:42\AtEndDocument? – touhami Apr 20 '18 at 09:19\nullin\AtEndDocument? Seems to work OK. I'll accept it as an answer if you post it. – David Purton Apr 20 '18 at 10:13