# Blur the whole document and add a demo watermark on each page

This question is about blurring text but it is not about blurring everything in the document. This shows how to add the watermark over all pages (but it does not work with pictures, this shows how to do it with some extra star over pictures).

How can I blur the whole document and add a DEMO watermark on each page and possibly leave only one sentence without blurring?

• Please be more specific about what you mean by "blurring". Should the letters be made fuzzy or out-of-focus looking, should they be rendered in gray instead of black, or maybe something else? – Mico Nov 15 '14 at 6:33
• @Mico every page should be blurred: unreadable text, unreadable images, unreadable tables, unreadable figures, unreadable author entries, unreadable title page...except the large watermark on top of the whole text. – hhh Nov 15 '14 at 6:38
• do you just need the text unreadable on paper or do you also want it to be not text in the pdf file? – David Carlisle Nov 15 '14 at 10:18
• Will there be math in the text that requires blurring, as well? – Steven B. Segletes Nov 15 '14 at 13:07
• After contemplating this, maybe something totally different could be adequate (but I have no idea how to accomplish this): Replace all text in the output - except the part that shall remain readable - with blind text ("lorem ipsum") in such a manner that tha paragraph shape is not affected; a good implementation of such a method might also use "blind math" for display formulas and "blind images" for illustrations ... – Hagen von Eitzen Nov 15 '14 at 15:01

Using Gonzalo's code with tikz

\documentclass{article}
\usepackage[printwatermark]{xwatermark}
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{lipsum}

\newsavebox{\waterbox}
\begin{lrbox}{\waterbox}
\begin{tikzpicture}[remember picture]
\fill[draw,white,opacity=0.7] ([shift={(2,2)}]current page.south west) rectangle (current page.north east);
\node[text width = 2in,rotate=-45] at ([shift={(10mm,10mm)}]current page.center) {Some text here that appeas dark and rest is blurred};
\end{tikzpicture}
\end{lrbox}

\newwatermark*[allpages,angle=45,scale=3,xpos=0,ypos=0]{\usebox{\waterbox}}

\begin{document}

\lipsum[1-2]
\begin{figure}[!ht]
\centering
\includegraphics[width=3cm]{example-image-a}
\end{figure}
\lipsum[1-2]
\lipsum[1-20]
\end{document}


You have to adjust the position of text in

\node[text width = 2in,rotate=-45] at ([shift={(10mm,10mm)}]current page.center) {Some text here that appeas dark and rest is blurred};


Now with eso-pic.

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

\newsavebox{\waterbox}
\begin{lrbox}{\waterbox}
\begin{tikzpicture}[remember picture]
\fill[draw,white,opacity=0.7] ([shift={(2,2)}]current page.south west) rectangle (current page.north east);
\node[rotate=45,text width = 0.5\textwidth,scale=2,anchor=center,align=center] at ([shift={(0.6\paperwidth,1cm)}]current page.west) {Some text here that appeas dark and rest is blurred};
\end{tikzpicture}
\end{lrbox}

\usepackage{eso-pic}
\usebox{\waterbox}
}

\begin{document}

\lipsum[1-2]
\begin{figure}[!ht]
\centering
\includegraphics[width=3cm]{example-image-a}
\end{figure}
\lipsum[1-2]
\lipsum[1-20]
\end{document}


This method will work with fully text documents only, but will break down for documents that include images and/or \colorboxes.

The macro \blurpages{start page}{end page}{PDF file} takes a complete unblurred document as its 3rd argument.

It builds successive blurry images for each page of the specified page range by stacking shifted images atop each other. It then outputs the blurred page and continues through the page range.

In this MWE, I operate on the file xcolor.pdf, the documentation for the xcolor package.

\documentclass[a4paper]{article}
\usepackage{graphicx,ifthen,xcolor}
\usepackage[usestackEOL]{stackengine}
\usepackage{everypage}
% THESE ARE LaTeX DEFAULTS; CAN CHANGE IF NEEDED.
\def\PageTopMargin{1in}
\def\PageLeftMargin{1in}
\newcommand\atxy[3]{%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{\textcolor{red}{#3}}}}}
\newcommand\ateveryxy[3]{%
\raisebox{\dimexpr\PageTopMargin+\voffset-#2\relax}{\textcolor{red}{#3}}}}}
% VERIFIED THAT SETTING \hoffset AND \voffset DO NOT BREAK SOLUTION.
%\hoffset=0.4in
%\voffset=0.2in
%WATERMARK ON EVERY PAGE
\ateveryxy{.5\paperwidth}{.55\paperheight}{\makebox[0pt]{\scalebox{15}{DEMO}}}
%CONSTRUCT BLURRED IMAGE
\setstackgap{L}{.4pt}
\newcommand\blur[2][1]{%
\Longstack{%
\,\includegraphics[page=#1,width=\paperwidth]{#2}\\
\,\,\,\includegraphics[page=#1,width=\paperwidth]{#2}\\
\includegraphics[page=#1,width=\paperwidth]{#2}\\
\,\,\includegraphics[page=#1,width=\paperwidth]{#2}\\
\,\,\,\,\includegraphics[page=#1,width=\paperwidth]{#2}
}%
}
%PLACE BLURRED IMAGES ON SUCCEEDING PAGES
\newcounter{blurpage}
\newcommand\blurpages[3]{%
\setcounter{blurpage}{#1}%
\whiledo{\value{blurpage}<#2}{%
\atxy{0in}{\paperheight}{\blur[\value{blurpage}]{#3}}\ \clearpage%
\stepcounter{blurpage}%
}%
\atxy{0in}{\paperheight}{\blur[\value{blurpage}]{#3}}\ \clearpage%
}
\pagestyle{empty}
\begin{document}
\blurpages{1}{9}{xcolor}
\end{document}


Here is where the method breaks down, however: if there are color filled regions, including both images and \colorboxes.