Old question, but the most voted answer doesn't really solve the problem.
\documentclass{book}
\usepackage[a6paper]{geometry}% just to make a smaller picture
\begin{document}
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
\clearpage
\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
\end{document}
You can note that the rule does not cover the whole paper width, because the margins are asymmetric. The trick only works if the margins are equal.
The real solution is very simple: use 2\paperwidth
. The PDF translation will truncate the part that goes beyond the MediaBox. Even better, use \maxdimen
, so there aren't edge cases for sure.
\documentclass{book}
\usepackage[a6paper]{geometry}% just to make a smaller picture
\begin{document}
\noindent\makebox[\linewidth]{\rule{\maxdimen}{0.4pt}}
\clearpage
\noindent\makebox[\linewidth]{\rule{\maxdimen}{0.4pt}}
\end{document}