104

I want to put a draft watermark using the below script but the problem is that the watermark don't come over the images and I want it to come over it.

\usepackage{draftwatermark}
\SetWatermarkText{DRAFT}
\SetWatermarkScale{1}
Tak
  • 2,346
  • 4
  • 20
  • 33
  • 2
    Are you looking for \SetWatermarkLightness{0}? – karlkoeller Jun 13 '13 at 06:00
  • 5
    Note that images in PDFs are stored in their original form and the watermark is just placed on top of it by the PDF viewer. As long the PDF is not encrypted the original images can be extracted using a PDF editing tool. – Martin Scharrer Jun 13 '13 at 06:48
  • The problem is that the watermark is displayed on the text but not the images – Tak Jun 13 '13 at 07:03
  • As Martin said, there might be problems when your images are in .pdf format. What kind of images are you dealing with? Can you add some more details in your question? – karlkoeller Jun 13 '13 at 07:23

1 Answers1

99

The problem is that the draftwatermark places the material in the background, so other elements (for example, figures and listings) might cover the included material; to prevent this, instead of using the draftwatermark package, you can use the xwatermark package; the starred variant of \newwatermark places the material in the foreground which seems to be what you need. A little example:

First, with the unstarred variant (material on the background, so a figure will be placed on top of it):

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

\newwatermark[allpages,color=red!50,angle=45,scale=3,xpos=0,ypos=0]{DRAFT}

\begin{document}

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

enter image description here

And now, with the starred variant (material on the foreground, so it will appear on top of figures):

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

\newwatermark*[allpages,color=red!50,angle=45,scale=3,xpos=0,ypos=0]{DRAFT}

\begin{document}

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

enter image description here

Gonzalo Medina
  • 505,128
  • 3
    Is it possible to make the foreground watermark tranparent, so that it doesn't render the text illegible? – SFAB Sep 10 '13 at 13:10
  • 1
    @SFAB please open a follow-up question with this requirement. – Gonzalo Medina Sep 10 '13 at 13:20
  • 3
    Done, see http://tex.stackexchange.com/q/132582/8277. – SFAB Sep 10 '13 at 13:41
  • Only difference is the star between the examples? \SetWatermarkText{P.s. Page limit 25...}. I used this watermarking here with \usepackage{blindtext} \usepackage{draftwatermark} but this technique did not work with the packages. You don't use any extra package?! – hhh Nov 15 '14 at 06:23
  • 2
    I got an error with \newwatermark: ! Missing number, treated as zero.<to be read again>X ...=60,scale=3,xpos=0,ypos=0]{DRAFT} – s.k Jun 25 '17 at 13:29
  • 7
    And is there any way to get *transparency* for the foreground watermark? – s.k Jun 25 '17 at 13:41
  • To change transparency, I just changed the number at color=red!50 – Homero Esmeraldo Jun 20 '19 at 15:46
  • 1
    s.k. - in your example the =60 is a transparency value. Change this number - lower this value to increase transparency. – Brandon Sep 05 '19 at 21:33
  • 4
    xwatermark stopped working in some recent latex version (I'm using the latest TinyTex), looking in the community it seems related to the catoptions package – Mojimi Feb 23 '21 at 01:57
  • 2
    I really like the package xwatermark but the sad news is, that there is no development in the package and I think it needs to be adopted to recent LaTeX Versions. I'll try to contact the author of the package. – Bastian Ebeling Mar 17 '21 at 05:51