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)?


You can use this with pdflatex --shell-escape


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}}}%


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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.