How to make \iflastpage{\newgeometry{bottom=40mm}}{} work to have a specific bottom offset for only the last page?
\documentclass{exam} \usepackage[14pt]{extsizes} \usepackage{lipsum} \usepackage[bottom=20mm]{geometry} \pagestyle{headandfoot} \newcommand{\myfooter}{\iflastpage{% {\centering\large End of the Exam}% \vspace{5pt}}{} \hrule\vspace{5pt} Instructors} \firstpagefooter{}{\myfooter}{} \runningfooter{}{\myfooter}{} \iflastpage{\newgeometry{bottom=40mm}}{} \begin{document} \lipsum[1-5] \end{document} 

\iflastpageto change the geometry of the last page? If yes, is there any other way to do so?End of the Examis not placed just above the footer horizontal rule.