1

I need to add a watermark on all pages of a latex document but the first.

Currently, I'm using the draftwatermark package, but I haven't suceeded yet.

Any advice or suggestion?

I tried the xwatermark package, as suggested here, but it came out that it is not compatible with other packages I'm using.

PieCot
  • 351

1 Answers1

1

Thanks to @Alenanno: I tried the solution he suggested and it worked like a charm! I slightly modified his code, adding a \watermarkon macro and now watermarks can be easily enabled/disabled for every single page.

This is my code:

\documentclass[12pt,a4paper]{exam}
\usepackage{draftwatermark}
\usepackage{etoolbox} 

%%%% for the 1 page %%%%
\usepackage[final]{pdfpages}
%%%%%%%%%%%%%%%%

\usepackage{blindtext}  
\SetWatermarkAngle{45} 
\SetWatermarkLightness{.8} 
\SetWatermarkFontSize{10cm} 
\SetWatermarkScale{8} 
\SetWatermarkText{\tt{DRAFT}}

%%% Macro to disable watermark
\makeatletter
\def\watermarkoff{%
        \@sc@wm@stampfalse
}
\makeatother

%%% Macro to enable watermark
\makeatletter
\def\watermarkon{%
        \@sc@wm@stamptrue
}
\makeatother


\begin{document} 

%%% no watermark on the first page
\watermarkoff
%%%% for the 1 page %%%%
\includepdf[pages={1},offset=0 0, delta=0 0, scale=1]{./lshort}
%%%%%%%%%%%%%%%%%%


%%% watermark on the second one
\watermarkon
\Blindtext
\newpage

%%% no watermark on the third page
\watermarkoff
\Blindtext
\newpage

%%% watermark on the remaining pages
\watermarkon
\Blindtext
\newpage
\Blindtext
\end{document}

And this is the result:

enter image description here

The first page (lshort) is the cover page of The (Not So) Short Introduction to LaTeX2e.

PieCot
  • 351