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)
Here's a quick and dirty solution:
\documentclass{article}
\makeatletter
\usepackage{tikz}
\usepackage{everypage}
\pgfmathsetseed{314}
\newlength{\obfobjectsize}
\setlength{\obfobjectsize}{36pt}
\newcommand{\obftext}{obfuscated}
\newcommand{\dontobfuscate}[1]{%
\ifmmode\let\@dollar=$\else\let\@dollar=\relax\fi
\vphantom{#1}\smash{\fboxsep=0pt\colorbox{white}{\@dollar #1\@dollar}}%
}
\newcommand{\setrandomcoordinates}{% Places random coordinates (in pt)
\pgfmathrnd % in \a and \b.
\let\a=\pgfmathresult
\pgfmathmultiply{\a}{\paperwidth}%
\let\a=\pgfmathresult
%
\pgfmathrnd
\let\b=\pgfmathresult
\pgfmathmultiply{\b}{\paperheight}%
\let\b=\pgfmathresult
}
\newcommand{\tkzplacerandomline}{
\setrandomcoordinates
%
\pgfmathrand
\let\c=\pgfmathresult
\pgfmathmultiply{\c}{\obfobjectsize}%
\let\c=\pgfmathresult
%
\pgfmathrand
\let\d=\pgfmathresult
\pgfmathmultiply{\d}{\obfobjectsize}%
\let\d=\pgfmathresult
%
\coordinate[xshift=\a,yshift=\b] (a) at (current page.south west);
\coordinate[xshift=\c,yshift=\d] (b) at (a);
\draw[ultra thick] (a) -- (b);
}
\newcommand{\tkzplacerandomcircle}{
\setrandomcoordinates
%
\pgfmathrnd
\let\c=\pgfmathresult
\pgfmathmultiply{\c}{\obfobjectsize}%
\let\c=\pgfmathresult
%
\coordinate[xshift=\a,yshift=\b] (a) at (current page.south west);
\draw[ultra thick] (a) circle (\c pt);
}
\newcommand{\tkzplacerandomnode}{%
\setrandomcoordinates
%
\pgfmathrandominteger{\c}{30}{330}
%
\coordinate[xshift=\a,yshift=\b] (a) at (current page.south west);
\node[rotate=\c] at (a) {\obftext};
}
\newcommand{\placerandomobjects}[2]{%
\begin{tikzpicture}[overlay,remember picture]
\foreach \n in {1,2,...,#2} { #1 }
\end{tikzpicture}%
}
\AddEverypageHook{
\placerandomobjects{\tkzplacerandomline}{100}
\placerandomobjects{\tkzplacerandomcircle}{100}
\placerandomobjects{\tkzplacerandomnode}{100}
}
\makeatother
\begin{document}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur
dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id,
vulputate a, magna. Donec vehicula augue eu neque. Pellentesque
habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla
et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit
amet tortor gravida placerat. Integer sapien est, iaculis in, pretium
quis, viverra ac, nunc. \dontobfuscate{Praesent eget sem vel leo ultrices
bibendum}. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar
at, mollis ac, nulla. Cur- abitur auctor semper nulla. Donec varius
orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis
quis, diam. Duis eget orci sit amet orci dignissim rutrum.
Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel,
wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at,
lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed
accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus
a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut
massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Aliquam tincidunt urna.
Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus
mauris. Nulla malesuada porttitor diam. Donec felis erat, congue non,
volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum
felis. \dontobfuscate{$E=m(a^2+b^2)$} Donec nonummy pellentesque
ante. Phasellus adipiscing semper elit. Proin fermentum massa ac
quam. Sed diam turpis, molestie vitae, placerat a, molestie nec,
leo. Mae- cenas lacinia. Nam ipsum ligula, eleifend at, accumsan nec,
suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend
consequat lorem. Sed lacinia nulla vitae enim. Pellentesque tincidunt
purus vel magna. Integer non enim. Praesent euismod nunc eu
purus. Donec bibendum quam in tellus. Nullam cur- sus pulvinar
lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum
pellentesque felis eu massa.
Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vitae
lacus tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. In hac habitasse platea dictumst. Integer tempus
convallis augue. Etiam facilisis.
\begin{displaymath}
\dontobfuscate{E=m(a^2+b^2)}
\end{displaymath}
Nunc elementum fermentum
wisi. Aenean placerat. Ut imperdiet, enim sed gravida sollicitudin,
felis odio placerat quam, ac pulvinar elit purus eget enim. Nunc
vitae tortor. Proin tempus nibh sit amet nisl. Vivamus quis tortor
vitae risus porta vehicula.
\end{document}
It is not very elegant, and especially the \dontobfuscate command is really very simple; it will work in horizontal mode (and generate a box, so it will be not breakable and the spaces will have their natural width, which will look ugly unless (a) only individual words are put in it or (b) the text is set ragged right or something similar; it will also work in math mode, but in a very primitive fashion (suitable for e.g. simple symbols). But it works as a proof of concept, and making it more versatile is now a question of some tweaking. Have fun!
PS. Not to mention that the "drm" tag might be considered a bit, say, offensive by some people in this community;).
Edit: as cjorssen mentioned in the comment, this needs two-pass compilation, since it uses the remember picture mechanism of tikz.
Best Answer
Here are a couple of options:
Method 1: Dot Grid, encoded "christian"
\setgrid[opt arg][opt arg]{letters}
\usegrid
The first optional argument sets the size of a grid cell, default is
10 pt
(units aren't entered). The second optional argument determines dot size. The dots are periods scaled via.\scalebox
the second argument gives the scale factor, default is0.3
. Each letter in the given word is converted first to a position in the alphabet (a=1
etc.) and then that alphabetic position is converted to a 5 digit binary number. Each such binary numbers is set as a column of vertical dots: 0 = no dot, 1 = dot. Columns are read from top to bottom (the first column is always filled with dots for reference). Thus, in the picture above:c->3rd letter->00011-> no dot, no dot, no dot, dot, dot
.The
\usegrid
macro then sets the grid. In the example I put it in the left header. You can put it wherever.Method 2: Dots in text, encoded "abba"
This one gives:
\markdoc{arg}{letters}
The first argument again sets dot size, and the second is letters. The letters
a1,...,aj
are converted to integersn1..nj
as above. In theith
line of text a dot will be placed beneath theni
th glyph. The letters can be recovered by counting glyphs (letters, punctuation, etc) from the left until you reach a dot, and then using the corresponding letter of the alphabet. This will occur on every page. Compile withlualatex
. Code borrowed liberally from here: https://tex.stackexchange.com/a/58327/14100