I've adopted this answer to rotate a table and its caption. I do not want to rotate the header, the footer, the section title not the paragraph on the same page.
Now I want to change the Rotate attribute as described here so that the page is turned to landscape by the viewer application. I know the same question has been asked in this duplicate, but I need to use xelatex and the compiler complains about pdfpageattr to be an undefined control sequence.
Am I right to assume that pdflscape has no option to prevent changes to the layout in the landscape environment?
mwe:
\documentclass[a4paper]{scrartcl}
\usepackage{%
,adjustbox%
,tabularx%
,ragged2e%
,blindtext%
,placeins%
% ,pdflscape% <- I only want the pdf viewer to rotate the page
}
\begin{document}
\section{Portrait page}
\Blindtext[3][1]
\pagebreak[4]
% \global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 90}
% --> Undefined control sequence. <--
% I can't use pdflscape's landscape environment as it changes the layout.
\section{Landscape page}
This running text should be ``portrait''--readable.
% (leave 10ex room for the title and the paragraph.)
\begin{table}[ht]
\begin{adjustbox}{minipage=\textwidth-10ex,%
addcode={\begin{minipage}{\width}}{%
\caption{%
Here is a caption of the table which is so long that
it has to be wrapped over multiple lines, but should
not exceed the width (height after the rotation) of the table.
}%
\end{minipage}},rotate=90,center}
\begin{tabularx}{\linewidth}{|r|XXXXX|}
\multicolumn{6}{c}{{\Large\slshape rotated table}}\\
& 1 & 2 & 3 & 4 & 5 \\\hline
a & b & c & d & e & f \\
a & b & c & d & e & f \\
a & b & c & d & e & f \\
a & b & c & d & e & f \\
a & b & c & d & e & f \\\hline
\end{tabularx}
\end{adjustbox}
\end{table}
\FloatBarrier
\pagebreak[4]
% \global\pdfpageattr\expandafter{\the\pdfpageattr/Rotate 0}
\Blindtext[2][1]
\end{document}