Monday, 14 July 2008

Latex goodie - How to watermark things in Latex/PDFLatex

I have been having problems since ever when trying to distribute some content to people and keeping track of the NDAs I make them sign. A sound solution (good but not really impossible to break) is to watermark the documents before sending. Then if you detect it in the wrong hands, you can ate least trace who did it.

I had for a long time a code to do this, but the real problem was that this code was actually in TeX, meaning that to make it appear in a PDF I have to convert from dvi to ps and then to pdf. I real pain, plus you finish loosing all the goodies from pdflatex, in term of hyperref.

I found a site[1], and with his instructions I managed to produce my own code to put the copyright watermark in my pdflatex documents, here it is:


{\fontsize{3cm}{3cm}\selectfont{Final Version}}}}%
{\fontsize{2cm}{2cm}\selectfont{Internal Use}}}}
{\fontsize{0.7cm}{0.7cm}\selectfont{\textcopyright Copyright 2008 - Jean Martina}}}}

You should put this code in your preamble, and it will put a watermark in all your pages. You can change the texts and their positions quite easily, just try it.



Anonymous said...

Works exactly the way I need it - great job, thanks a lot!

Habi said...

thanks, i just used this for a progress repord i had to hand in.

Anonymous said...

you should also be able to use


this single line does all the work and is compatible with pdflatex. size and brightness can be set like this

\SetWatermarkLightness{ 0.95 }
\SetWatermarkScale{ 5 }

this scales the watermark to the whole page. et voila 3 pretty lines and all work is done.

have fun!

Jean E. Martina said...

How do you change the text when using \usepackage{draftwatermark} ?

This is why I don't use that.....

Anonymous said...

Just use:

\SetWatermarkText{my text}

Life can be so easy. But learning how to script tex is also fun :-)

bth said...

Thanks! Very useful.

Unknown said...

I really wanted to use the draftwatermart, but found that i didn't support color. the watermark package does not use transparency by default, and transparency is not working with dvi files; ordinary latex, that is.

So, to be able to use a "watermark" regardless, I made the following in the preamble:

\newcommand{\wmtext}{\huge\textsc{PRELIMINARY DRAFT for
} %
} %

Anonymous said...


KC7HP said...

draftwatermark package crashes my TeX with too much memory use. Morton's code works fine. I augmented with 'anysize' package to crank the watermark larger, replacing text line with:

\newcommand{\wmtext}{\fontsize{90}{80}\selectfont DRAFT}