86

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?

5
  • 20
    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. May 24, 2011 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"? May 24, 2011 at 20:26
  • @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? May 24, 2011 at 21:56
  • @Peteris: p. s. sorry if my wording is too complicated :-( May 24, 2011 at 22:01
  • @Peteris: How to guarantee the mark cannot be removed? Jun 22, 2011 at 10:20

8 Answers 8

71

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)

(Dot which nearly invisible text on top of it)

6
  • 9
    Very nice trick
    – raphink
    May 24, 2011 at 20:33
  • 1
    Is there some way to add the msg to every dot automatically?
    – hhh
    Feb 14, 2012 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, 2012 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, 2012 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. Feb 14, 2012 at 19:49
35

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!

enter image description here

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

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

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}

enter image description here

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.

9

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.

7

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.

2
  • 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). May 24, 2011 at 15:22
  • 5
    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. May 24, 2011 at 16:50
4

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...

1
1

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.

3
  • 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.
    – user31729
    Dec 3, 2014 at 20:59
  • It depends on what the OP is really asking for. Is it "invisible watermarks"? Or is it "How do I trace leaks"? I interpret "invisible watermarks" as merely a means to an end, which is: how do I find out who leaked a copy of my document? What I am proposing is to make each copy of the document traceable by inserting an unnoticeable, yet unique pattern of words in a specific part of the document. Make a note of which version was received by each individual on the distribution list.
    – Pierre
    May 9, 2017 at 14:29
  • Then, when OP notices a leaked copy of his document, he simply goes to the section of the document with the unique word pattern, compares it to each copy of the document that was doctored differently, and identifies the individual who received that specific version.
    – Pierre
    May 9, 2017 at 14:34
0

@MartinScharrer's idea is very nice.

I'll add a few more ideas (which also should be rather easy to put into practice) without providing the real implementation:

  1. Make the text invisible, by coloring it white on white background (or $anycolor on $anycolor background).

  2. Make the text invisible by placing it on a black line (fontsize small enough to not overflow the line, or line thick enough to let the text disappear).

  3. Use 'text rendering mode 3' (== "don't strike and don't fill the character shapes") to write the text.

  4. Create your own very simple font (for example with the help of FontForge). It only needs to contain all the ASCII characters (or even less: only those characters you want to use -- maybe only numbers?), but each character's shape ("glyph"), including the 'blank'/'space' one, should be the same and look very harmless and innocent, for example a black square. You could load this font even into applications like LibreOffice: you type a text when this font is active, and what appears on screen, in print or in exported PDFs are only black squares. However, from the PDF the text can still be marked and copied or converted to text. If you adjust the font's character widths correctly, the black squares will even form long black lines.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .