Changing page size mid-document should be a basic, easy to use feature but it isn't.
I am developing upon the answer given at Change paper size in mid-document
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{lipsum}
\usepackage{graphicx}
\begin{document}
Normal page
\eject \pdfpagewidth=3in \pdfpageheight=5in
Tall page
\begin{figure}
\centering
\includegraphics{example-image-a}
\end{figure}
\eject \pdfpagewidth=18in \pdfpageheight=3in
Wide page
\lipsum[1-2]
\begin{figure}
\centering
\includegraphics{example-image-b}
\end{figure}
\begin{table}
\centering
\begin{tabular}{lc}
A & B\
c & D
\end{tabular}
\end{table}
\end{document}
There are a lot of problems:
modifying
\pdfpagewidthdoes not modify\paperwidthwhich is commonly used to modify image sizeThe page number is shown only on the first page. How to show it on other pages and place it in the centre of the bottom of the page.
Why is "Tall page" shown at the bottom of the page?
Where is
example-image-a?Where is the table?
Where is the text placed by
\lipsum?example-image-bhas been centred, but in the output it is in the left side of the page.

example-image-abecause they are typeset outside the page. Are there specific reasons you cannot usetypeareapackage? – muzimuzhi Z Nov 12 '21 at 06:33typeareapackage. Does it provide an acceptable solution? – Viesturs Nov 12 '21 at 06:36typeareaexample under the question you mentioned. – muzimuzhi Z Nov 12 '21 at 06:38\newgeometrycommand since you are loading thegeometrypackage that defines it. If you use tex primitive settings mid document without re-calculating all the latex structures built on them then things will break. – David Carlisle Nov 12 '21 at 07:44\newgeometrycommand but I encountered a problem which I have described in another question https://tex.stackexchange.com/questions/622303/change-page-size-mid-document-with-newgeometry – Viesturs Nov 12 '21 at 07:49\newgeometrysolution in the real document. The first impression is rather agreeable. Maybe somebody will answer this question explaining the limitations of\ejectand will point to better solutions. – Viesturs Nov 12 '21 at 08:58\tinyfont size. – Viesturs Nov 12 '21 at 09:06