2

I want to protect my e-mail address against spammers by including it as image instead of a (parsable) text. Normally I would have to create the image (with text) by myself and include this as figure. Is there a way of automatizing this (e.g. a package)?

Akantor
  • 51
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Apr 16 '15 at 11:13
  • See http://tex.stackexchange.com/questions/150375/crawler-resistance-email-address, for example, and other related questions. – Steven B. Segletes Apr 16 '15 at 11:21
  • Also, http://tex.stackexchange.com/questions/11307/is-it-possible-to-produce-a-pdf-with-un-copyable-text. – Karalga Apr 16 '15 at 11:25
  • Thank you for pointing me to that, I already saw these posts. I am looking for a picture only solution which does not involve a third application as the domain should be obfuscated as well.. – Akantor Apr 16 '15 at 11:35
  • Using an image excludes visually impaired people. Therefore you also would need an audio file at least. And the spammers just continue with OCR ... – Heiko Oberdiek Apr 16 '15 at 12:28
  • Is this really a problem? My email address has been in a href="mailto: on my web site for years. About the only spam I get these days (or at least the only ones who get through the spam blockers) are idiots who think I should be selling life insurance. – John Kormylo Apr 16 '15 at 17:18

1 Answers1

5

You can use this with pdflatex --shell-escape

\documentclass{article}
\usepackage{graphicx}

\def\hideemail#1#2{%
\IfFileExists{#1.png}{}%
{\immediate\write18{%
echo '\detokenize{\setbox0\hbox{\strut #2}\hoffset-1in\voffset-1in\pdfpageheight\baselineskip
\pdfpagewidth\wd0\shipout\box0\bye'|pdftex;convert -density 600 texput.pdf #1.png}}}%
\box0{#2}%
\raisebox{-\dp\strutbox}{\includegraphics[width=\wd0]{#1.png}}}%

\begin{document}

some text with \hideemail{myemail}{david@example.com} an address

\end{document}

The exact command sequence written to the \write18 line depending on the utilities and operating system you have available. It uses plain pdftex to write a pdf just containing the address, then imagemagic convert to make a png.

the result is

enter image description here

However this gives absolutely no security to the email address, for example if I load the pdf (or even the png image of the pdf as uploaded to this site) into google docs it OCRs it automatically producing

 some text with david@example.com an address

as plain text.

If google can OCR that automatically on file upload, so can whoever you are trying to hide this from.

David Carlisle
  • 757,742