# How to add an invisible watermark to pdf documents?

I'd like to add an invisible watermark to each PDF document that I produce so that in case it leaks, I know where it leaked from. Anyone knows what would a good way for an invisible watermark be in a PDF document and how to add one?

-
Another option is to add a watermark that is clearly visible but does not look like a watermark. You can simply use a script that constructs a large number of slightly different variants of the document. Depending on the nature of your text, you could vary: strings or numbers that you use as examples; the labelling of the elements of figures; the choice of the variables and other mathematical symbols; which fragments from your source material you use as examples; decorative symbols and illustrations; ... To implement all this, simple Latex macros will help a lot. –  Jukka Suomela May 24 '11 at 15:51
@Peteris Krumins: do you want to distinguish different "versions" of the same document which you sent to different persons? You say you want to add the watermark to each document you produce, but from the rest of your question it seems that you send one and the same document to different possible "leaks"? –  Martin May 24 '11 at 20:26
@Martin: no, not different versions. It's the one and the same document for everyone. –  Peteris Krumins May 24 '11 at 21:29
@Peteris: with the quotes around "versions" I wanted to show that they are identical. So you want to be able to distinguish those "different same" documents you sent to different people, no? So the obviously visible content would be the same for all documents and you want to add a "specific" identifier which is related to the person you've sent the document to? –  Martin May 24 '11 at 21:56
@Peteris: p. s. sorry if my wording is too complicated :-( –  Martin May 24 '11 at 22:01

Here a funny idea: Just place some watermark/copyright text on top or below of a dot or other punctuation mark. It is invisible for the naked eye if it uses the same color as the text but can be extracted using copy and paste. You can also give it a dark gray color, so you still have a chance to read it on screen.

Here some principal solution:

\documentclass{article}

\usepackage{graphicx}
\usepackage{xcolor}

\newcommand\watermark[1]{%
#1%
\sbox0{#1}%
\llap{%
\makebox[\wd0][c]{%  hor. centering
\raisebox{.5\ht0}{%  approx. vert. centering
\csname Gin@isotrue\endcsname% = "keepaspectratio"
\resizebox*{.8\ht0}{.8\ht0}{% Scale down (the height is also used for the width to avoid the surrounding spaces)
\parbox{10em}{% Allow line breaks
\color{black!90}%
This PDF was created by John Doe for Jane Doe.
}%
}}}}%
}

\begin{document}
Text text text.

Text text text\watermark.

\end{document}


The dot will then look like this: (note the hard to see text)

-
Very nice trick –  ℝaphink May 24 '11 at 20:33
Is there some way to add the msg to every dot automatically? –  hhh Feb 14 '12 at 16:39
...and some easy way to keep up with version numbering or hashes in such dots? Perhaps to use many dots :) –  hhh Feb 14 '12 at 16:56
...I have 16 times zoom in Xpdf in Ubuntu, cannot still see anything. Really working? Nice, I can only see something when I change the font to white but if I ended up into a situation to prove that a copyright notice is written on the dot -- I would be a bit skeptical -- this may get corrupted somehow to become unreadable? –  hhh Feb 14 '12 at 17:07
@hhh: No, there is no automatic way to add it to all dots. This answer is about the principle solution. Adding version numbering is a question of its own. I can see the message well using Adobe Acrobat Reader and you can also mark and copy it as text. Because it is text, just smaller than usual, it will not be corrupted. –  Martin Scharrer Feb 14 '12 at 19:49

How about embedding it in an image with steganography, most of the image manipulation libraries such as the GD library have routines available or you can run copies individually and use TikZ!

The message is encrypted in the yellow dots! Some color printers still do it see printer steganography

-
+1 Steganography is very good if you want to keep the watermark a secret. You can even use it with cryptography/digital signature. –  Martin Scharrer May 24 '11 at 19:37
Can it be removed by a special software? –  xport Jun 22 '11 at 10:16
@xport Anything is possible with the right software, but you need to rewrite the printer drivers and possibly more. –  Yiannis Lazarides Jun 22 '11 at 10:51

With the new version (v2.2 - still in CTAN upload process, but should be available soon) of pdfcomment you could use an 'invisible' PDF tooltip.

\documentclass{article}
\usepackage{marginnote}
\usepackage[author={Peteris Krumins}]{pdfcomment}
\begin{document}
This\marginnote{\pdftooltip{\rule{0pt}{0.5cm}\rule{0.5cm}{0pt}}{handed over to:\textCR Peteris Krumins}} is just a test sentence.
\end{document}


As soon as you hover over the 0.5cm/0.5cm rectancle in the margin the tooltip pops up. Of course you can put the tooltip in the header/footer or whereever you want.

-

Easy way to achieve this, is to intentionally put some carefully placed typos (or punctuation, any sort of slight modification), of no real consequence to the document, prior to issuing it to the respective party, ensuring that you keep a ledger of what changes were made. When the leaked document is identified, cross-reference it with your ledger, then (depending on the nature of your work) call your lawyer and instruct him/her to issue a C&D, or instruct your assets to act accordingly.

-

Here is a somewhat academic idea: encode the watermark in the spacing of words or even letters. I don't know a package to support this, though. The obvious benefit is that this encoding survives printing the document before passing it on.

Addendum: A variation of this is to individualize a document by tweaking the textwidths of some (or all) paragraphs ever so slightly. That will result in different line breaking and spacing decisions. This would not qualify as an encoding but as long as you know which version was given to whom you would know who leaked a document.

I did some experiments that suggest that very small variations to the text width are invisible to the eye but lead to the desired variations of paragraph layout.

-
Any space encoding large enough so it can reliable read back from a print-out will disturb the overall appearance. Also I don't think this is implementable in TeX (within a generously reasonable amount of effort). –  Martin Scharrer May 24 '11 at 15:22
How about this: documents could be individualized by tweaking the textwidths of some (or all) paragraphs ever so slightly. That will result in different line breaking and spacing decisions. This would not qualify as an encoding but as long as you know which version was given to whom you would know who leaked a document. –  Christian Lindig May 24 '11 at 16:50

If you're looking to track the document itself, it might not be a bad idea to include a serial number or something so that you can track it in printed and photocopied copies...

-
Serial number might be removed before sharing. –  xport Jul 3 '11 at 22:24

Any text can be copied & pasted into a text editor, thus losing all special markings. Random and unique changes in the choice and order of words would seem to be the only sure-fire way of tracing leaks.

-
Welcome to TeX.SX I don't think that this was what the OP had in mind when asking about invisible watermarks. You should elaborate on your post, improving and showing that it would be a solution, otherwise it's at best unclear at the moment and at worst no solution at all. –  SoundsOfSilence Dec 3 '14 at 20:59
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Werner Dec 3 '14 at 21:06