# Black vertical rectangle on left margin

I print my document on A5 paper. I have a template with header and footer. Now, my laserjet printer is spoiling the page by leaving black marks on left margin. How can I draw a black vertical strip of 5 mm width on the left margin to hide these marks?

-

With background package.

\documentclass[a5paper]{article}

\usepackage{background}
\usetikzlibrary{calc}
\newsavebox\mybox
\sbox\mybox{%
\begin{tikzpicture}[remember picture]
\fill[black] (current page.north west) rectangle ($(current page.south west) +(5mm,0)$);
\end{tikzpicture}%
}
\backgroundsetup{
angle=0,
scale=1,
opacity=1,
color=black,
contents={%
\begin{tikzpicture}[remember picture, overlay]
\node[anchor=west] at  (current page.west) {\usebox{\mybox}};
\end{tikzpicture}%
}
}
\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document}


-
Why the extra box and the three levels of nesting tikzpictures (the package already uses one)? It's enough to say \backgroundsetup{ angle=0, scale=1, opacity=1, color=black, contents={ \begin{tikzpicture}[remember picture,overlay] \fill[black] (current page.north west) rectangle ([xshift=5mm]current page.south west); \end{tikzpicture} } }; the calc library also isn't required. –  Gonzalo Medina Mar 20 '14 at 12:15
@GonzaloMedina box is used with an intention to reduce load. And xshift is a good idea. Using calc has been a habit for me though :) Thanks. :) –  Harish Kumar Mar 21 '14 at 2:32

With the help of \AddToShipoutPictureBG from the eso-pic package, we draw a black rectangle at the shipout of every page.

MWE

\documentclass[a5paper]{article}

\usepackage{tikzpagenodes}
\usetikzlibrary{calc}

\usepackage{eso-pic}
\begin{tikzpicture}[remember picture, overlay]
\fill[black] (current page.north west) --
($(current page.north west) +(5mm,0)$) --
($(current page.south west) +(5mm,0)$) --
(current page.south west);
\end{tikzpicture}%
}

\begin{document}

\section{A section}
Some text\newpage

\section{Another section}
Some text

\end{document}


Output

-
Can we make the open side wavy ribbon like? –  Vaibhav Mar 19 '14 at 9:56
@user34083 this goes beyond my tikz knowledge... Please ask a follow-up question for this. –  karlkoeller Mar 19 '14 at 9:58