\newlength{\linedst}
\setlength{\linedst}{5mm}

\newlength{\morex}
\newlength{\morey}
\setlength{\morex}{3cm}
\setlength{\morey}{3cm}

\documentclass{article}
\usepackage{ifthen}
\begin{document}
\thispagestyle{empty}
\newlength{\tmpsize}
\newlength{\maxpageysize}
\newlength{\pageysize}
\newlength{\pagexsize}
\newlength{\maxpagexsize}
\setlength{\pagexsize}{-\morex}
\setlength{\pageysize}{-\morey}
\setlength{\maxpageysize}{\textheight}
\setlength{\maxpagexsize}{2\morex}
\addtolength{\maxpagexsize}{\textwidth}
\addtolength{\maxpageysize}{2\morey}
\addtolength{\maxpageysize}{-\linedst}
\addtolength{\maxpageysize}{-\linedst}
\begin{center}
\whiledo{\lengthtest{\pageysize<\maxpageysize}}{%
\makebox[0cm][c]{\raisebox{-\pageysize}[0em][0em]{\rule{\maxpagexsize}{.26mm}}}%
\addtolength{\pageysize}{\linedst}%
}%
\addtolength{\maxpagexsize}{-\morex}%
\addtolength{\maxpageysize}{\morey}%
\addtolength{\maxpagexsize}{-\linedst}%
\makebox[0cm][c]{\raisebox{\morey}[0em][0em]{%
\setlength{\tmpsize}{-\pageysize}%
\addtolength{\tmpsize}{-\maxpageysize}%
\addtolength{\tmpsize}{-.5\tmpsize}%
\addtolength{\tmpsize}{-.5\morey}%
\addtolength{\tmpsize}{.5\linedst}%
\raisebox{\tmpsize}%
{%
\whiledo{\lengthtest{\pagexsize<\maxpagexsize}}%
{%
{\makebox[0em]{\rule{.26mm}{\maxpageysize}}}\rule{\linedst}{0em}\makebox[0em]{\rule{.26mm}{\maxpageysize}}%
\addtolength{\pagexsize}{\linedst}%
}%
}}}%
\end{center}
\end{document}
