# How to know if page is empty

Looking for macro to know if the current page is empty , and opening new page if were not as well. Is there any idea to do that? example in this MWE

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}

\newcommand{\border}{\begin{tikzpicture}[remember picture, overlay]
\coordinate (top) at ($(current page.north)+(0,-1.5)$);
\coordinate (bottom) at ($(current page.south)+(0,1.5)$);
\coordinate (left) at ($(current page.west)+(1.5,0)$);
\coordinate (right) at ($(current page.east)+(-1.5,0)$);
\draw[red] (bottom-|left) rectangle (top-|right);
\end{tikzpicture}}

\begin{document}

\lipsum

\border

\end{document}

I want to put the frame in a blank page after the text

-
Define "empty". No content but has a header/footer? How about creating a minimal working example (MWE) that shows what you mean by "empty" and "not empty" in addition to the result from this condition. –  Werner Jul 25 '14 at 16:59
i mean 'empty page' totally blank –  salim bou Jul 25 '14 at 17:03
You can insert \newpage or \clearpage to move to a blank page. –  Werner Jul 25 '14 at 17:19