# How to make some character “unreadable” as text in the pdf output but still visible?

This question might be seen is a follow up/complement to this question and answer. I'm actually taking the example from there:

\documentclass{article}
\usepackage{xcolor}
\usepackage{transparent}
\begin{document}
horse

ho\phantom{r}se

ho\textcolor{white}{r}se

ho\makebox[0pt]{{\transparent{0}r}}se
\end{document}


Four times the word horse. The first one is the regular word. The 2nd appears as ho se, because the r is invisible. The third also appears as ho se, but in contrast with the previous case, the word "horse" is contained in the document (appears as a search result, the copy/paste of the text, and the output of pdftotext). The last example appears as hose visually, but the text "horse" is contained in the pdf.

I need a the opposite case: I want the r to be visible but not contained in the text of the pdf. In other words, I want to be able to see the word horse on the pdf, but when searching the document (or mouse select + copy/paste, or pdftotext output), only the word "hose" appears.

Is this possible?

• – David Purton Jul 23 '18 at 3:39
• From my brief looking around, if you want to do this just for some words, the only option seems to be the pst-text package, which means you are stuck with latex→dvips→ps2pdf. If you want to do it for the whole document, you can use ghostscript to outline all fonts. – David Purton Jul 23 '18 at 4:07
• Or if you only need the word horse, you could make the letter in inkscape and include it as a tikz picture. – David Purton Jul 23 '18 at 4:31
• I don't know why, with MikTeX your example doesn't compile and says ! Undefined control sequence <argument> {\transparent{0}r} – AndréC Jul 24 '18 at 5:37
• Are you using pdflatex @AndréC? \transparent only works in PDF mode, not dvi – phollox Jul 24 '18 at 10:48

Just use the accsupp (Accessibility Support) package.

\documentclass{article}
\usepackage{accsupp}
\begin{document}
\BeginAccSupp{ActualText=hose}%
horse%
\EndAccSupp{}%
\end{document}


\$ pdftotext test.pdf -
hose

1

• Thanks for the help @Henri-Menke. Quite a hack for the PDF. Never even crossed my mind searching for accessibility options, but it makes sense. Thanks again – phollox Jul 23 '18 at 16:58