I use pgfpages for the handouts from my beamer presentations as well. I have a layout that puts a border around each frame as I find that makes it easier to separate the frames visually. I'd also noticed the frame around empty pages at the end but hadn't thought to try to fix it until now (though I agree that it doesn't look great to have them there, particularly as the borders are a bit thicker - because of the implementation). However, someone asking is a great motivation for getting rid of such annoyances. So here's a solution.
I use a custom layout that puts a border around each page and allows for shrinkage of the pages. Before putting the border round, though, it tests to see if there is actually anything on the page. If not, it doesn't do the border.
\documentclass[handout]{beamer}
\usepackage{pgffor}
\makeatletter
\def\strokeifnotempty{%
\expandafter\ifvoid\csname pgfpages@box@\the\pgf@cpn\endcsname
\let\@next=\relax
\else
\let\@next=\pgfstroke
\fi
\@next%
}
\makeatother
\mode<handout>
{
\usepackage{pgf}
\usepackage{pgfpages}
\pgfpagesdeclarelayout{8 on 1 boxed}
{
\edef\pgfpageoptionheight{\the\paperheight}
\edef\pgfpageoptionwidth{\the\paperwidth}
\edef\pgfpageoptionborder{0pt}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=8,%
physical height=\pgfpageoptionheight,%
physical width=\pgfpageoptionwidth%
}
\pgfpageslogicalpageoptions{1}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.25\pgfphysicalwidth}{.875\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{2}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.75\pgfphysicalwidth}{.875\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{3}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.25\pgfphysicalwidth}{.625\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{4}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.75\pgfphysicalwidth}{.625\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{5}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.25\pgfphysicalwidth}{.375\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{6}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.75\pgfphysicalwidth}{.375\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{7}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.25\pgfphysicalwidth}{.125\pgfphysicalheight}%
}%
\pgfpageslogicalpageoptions{8}
{%
border code=\pgfsetlinewidth{2pt}\strokeifnotempty,%
border shrink=\pgfpageoptionborder,%
resized width=.5\pgfphysicalwidth,%
resized height=.5\pgfphysicalheight,%
center=\pgfpoint{.75\pgfphysicalwidth}{.125\pgfphysicalheight}%
}%
}
\IfFileExists{\jobname.aux}{
\pgfpagesuselayout{8 on 1 boxed}[a4paper, border shrink=5mm]
\nofiles
}{}
}
\begin{document}
\foreach \k in {1,...,5} {
\begin{frame}
Frame \k
\end{frame}}
\end{document}
The \IfFileExists bit is to circumvent the interference that Daniel mentions. The first time that this is compiled it does not do the multipage layout but does write to the auxfile. On subsequent runs, it does the multipage layout but doesn't write to the auxfile. This helps with absolute positioning and labels and the like.
Here's the output of the above:

\documentclass[10pt,handout,mathserif]{beamer} \usepackage{amsmath,amssymb,amsfonts,amsthm} \usepackage{graphicx} \usepackage{color} \usepackage{framed} \usepackage{amsthm, array} \usepackage{yhmath} \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfpages} \setbeamertemplate{background canvas}{ \tikz \draw (current page.north west) rectangle (current page.south east); } \pgfpagesuselayout{8 on 1}[letterpaper,border shrink=1mm] \begin{document} \foreach \x in {1,...,8} {\begin{frame}{Title \x}The frame number \x\end{frame}} \end{document}– percusse Apr 27 '12 at 01:16