I want to make sure the last page always be even, so I defined command as the following:
\documentclass{article}
\usepackage{lipsum}
\usepackage[paperwidth=302pt,paperheight=400pt, offset=0pt, hmargin=40pt, tmargin=50pt,
bmargin=75pt, noheadfoot]{geometry}
\newcommand{\OpenNewPageIfNeeded}{%
\ifodd\value{page}%
\newpage%
\hbox{}%
\else%
\fi%
}
\AtEndDocument{\OpenNewPageIfNeeded}
\begin{document}
\lipsum
\end{document}
This works for most of the cases, but fails sometimes, for example the above sample code.
It seems that this question is duplicated with Ensure last page is even and blank, I tried the solution but it still fails, any suggestions?