[Tex/LaTex] Vector frame on all pages

framed

I would like a regular frame about 0.5cm outside the text margin for every page in a report. I have checked different options such as the Wallpaper package, Showframe package and the showframe option of Geometry. I've also seen one-page only solutions using Tikz.

I have an unspecified number of pages in the document, and I would like the frame on every page, enclosing the all the text of the page (including page numbers, headers and footers). I'd also like some choice in the line style (such as double line, dashed, or dotted).

I have a hunch that this could be done with Pstricks or with Tikz, but my knowledge of either of these is marginal…any help would be appreciated.

Best Answer

You can use the background package; in the contents={} option you can place your frame using TikZ and give it the desired look; a simple example:

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

\backgroundsetup{
color=black,
scale=1,
opacity=1,
angle=0,
contents={\tikz\draw[line width=1pt,rounded corners,olive]
  ( $ (current page.south east) + (-3,5) $ ) rectangle ( $ (current page.north west) + (2,2) $ );}
}

\begin{document}

\lipsum[1-40]

\end{document}

An image of the first two pages:

enter image description here

If the latest version of background is not yet available in your system, you can use the old syntax:

\SetBgColor{black}
\SetBgScale{1}
\SetBgOpacity{1}
\SetBgAngle{0}
\SetBgContents{\tikz\draw[line width=1pt,rounded corners,olive]
  ( $ (current page.south east) + (-3,5) $ ) rectangle ( $ (current page.north west) + (2,2) $ );}

(the old syntax still works in the new version.)

As a personal note, I don't know if using this kind of frame in a document is a good idea.