Rotating a one-page float for pdf viewing

Since the rotated table will take up a full page anyway (not as complex to position as a partial-page float), you can use afterpage to avoid breaking up the text flow.

\documentclass{article}

\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{lipsum} % for filler text only

\begin{document}
\pagestyle{myheadings} % to show header behavior
\lipsum
\afterpage{%
  \begin{landscape}
    \begin{table}[p]
      \caption{Rotated table caption.}
      \lipsum[1]
    \end{table}
  \end{landscape}
}
\lipsum
\end{document}

I ended up using the following construct:

main file had:

\input{tex file with the table}

and the tex file with the table had:

\afterpage{\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}}
\begin{sidewaystable}
...
\end{sidewaystable}
\afterpage{\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}}

and it worked perfectly with the original tables that I had in mind when I asked this question.

Here's an interesting thing though. Later in the document a second full page sideways table arose and I tried the exact same approach. I'm on a Mac and use TeXShop. In both the TeXShop pdf viewer and Preview, a few pages that followed the second table (which should have resumed to portrait viewing) stayed in landscape. Then portrait viewing resumed for a few pages. But then the last few pages went back to landscape viewing (and should not have). This was pretty bizarre behavior and I confirmed it happening on someone else's iPad viewing of the pdf (may have been Preview again). But perhaps even stranger was that if we opened the pdf using an Adobe viewer (on a Mac or a PC) or with Sumatra on a PC, only the appropriate pages viewed in landscape mode.

I eventually resolved the issue by pulling the line

    \afterpage{\global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}}

out of the input tex file and putting it directly in the main file after the \input call. After this, all these pdf viewers behaved with the document as desired. It's strange that different pdf viewers behaved differently. I'm willing to chalk this up to a problem with those pdf viewers and not with tex. But I thought it worth noting here.