Is it possible to have float-only pages, containing sideways tables or figures produced by the sidewaystable or sidewaysfigure environments of the rotating package, automatically rotated in the PDF output?
This question is related to 3 existing questions:
Rotate single PDF page when viewing
floating sideways table on a rotated page in pdf-viewer
Problems with newpage and pdfpageattr
I've tried the answers given there, based on \pdfpageattr and \afterpage from the afterpage package, with or without \BeforeBeginEnvironment and \AfterEndEnvironment from the etools package, or even modifying directly the definition of sidewaystable say, something like
\makeatletter
\renewenvironment{sidewaystable}
{\@rotfloat{table}%
\global\pdfpageattr\expandafter{/Rotate 90}}
{\afterpage{\global\pdfpageattr\expandafter{/Rotate 0}}%
\end@rotfloat}
\makeatother
Things always end up like in this screenshot:
Namely, not only the page with the actual sideways table is rotated, but also the page where the sidewaystable environment appears in the LaTeX source.
Of course, it's always possible to rotate pages manually in the PDF output, but it would be nice to have sidewaystable etc. rotate the pages automatically. I'm looking for a solution that only rotates the PDF page where the sideways table or figure is floated to, without otherwise altering the formatting in any way (namely, no use of \clearpage, \pagebreak or the landscape environment).

advertismentenvironment, too? But this sounds very nice indeed .... – cfr Oct 13 '23 at 20:12