# Floating landscape environment

I have this construct in my document of a table that goes over the whole landscaped page.

\documentclass{article}
\begin{document}
\begin{landscape}
\begin{table}
% lot of information, goes over whole page
\end{table}
\end{landscape}
\end{document}


The only problem is the table goes exactly where I place it. The problem with using \begin{sidewaystable} from the rotating package is that it does not rotate the page when viewing it on PDF.

EDIT: Goal is to rotate the object and keep it as floating at the same time. (As pointed out by @Skillmon.)

• Possible duplicate of Rotate single PDF page when viewing – nox Sep 18 '18 at 18:02
• Multiple solutions in the link above. I think the easiest one is to use the package pdflscape instead of lscape. – nox Sep 18 '18 at 18:04
• @Skillmon correct! – Ben L Sep 18 '18 at 19:16
• This is no duplicate of the question linked by @nox as this question not only asks to rotate the pdf page but also to keep it as a float. – Skillmon likes topanswers.xyz Sep 18 '18 at 19:16

\documentclass{article}
\usepackage{rotating,fancyhdr,ifthen}
\ifthenelse{\equal{\value{page}}{\pageref{tt}}}
{landscape \global\pdfpageattr{/Rotate 90}}
{portrait \global\pdfpageattr{}}}
\pagestyle{fancy}
\begin{document}

aaaa

\begin{sidewaystable}
\centering
TTTTTTTTTTTTTTTTTTTT
\caption{ttttt\label{tt}}

\end{sidewaystable}

aaaaa

\pagebreak

aaaaa

aaaaa

\end{document}