I would like to create a macro that converts its paramater into an image with the goal that the text within this macro is not found using the search feature built into standard PDF viewers.
Thus, searching the resulting document for "text" should produce only two matches and not four. That is, any text in the highlighted box should ignored.
Use-Case
I generate a large index of files and want to be able to search by the index entry only (and not the files names).
MWE:
\documentclass{article}
\usepackage{tikz}
\tikzset{Node Style/.style={draw=red, thin, fill=yellow!50, anchor=base, inner sep=1pt,}}
\newcommand{\NonSearchableText}[2][]{%
\tikz[baseline] \node [Node Style, #1] at (0,0) {#2};%
}%
\begin{document}
\textbf{searchable text}
\indent\NonSearchableText{non-searchable-text}
\textbf{searchable text}
\indent\NonSearchableText{non-searchable-text}
\end{document}
Desired Ouput
The desired output can be created by using the first file here to create the image non-searchable-text.png which is included by the second.
File name:
non-searchable-text.tex%%% https://tex.stackexchange.com/questions/34054/tex-to-image-over-command-line \documentclass[convert={density=300,outext=.png}]{standalone} \usepackage{tikz} \tikzset{Node Style/.style={draw=red, thin, fill=yellow!50, anchor=base, inner sep=1pt,}} \newcommand{\NonSearchableText}[2][]{% \tikz[baseline] \node [Node Style, #1] at (0,0) {#2};% }% \begin{document} \NonSearchableText{non-searchable-text} \end{document}Main File:
\documentclass{article} \usepackage{graphicx} \usepackage[export]{adjustbox} %% https://tex.stackexchange.com/questions/98297/create-command-to-inline-an-image-in-a-question \newcommand*{\Image}[1]{\includegraphics[valign=m]{#1}}% \begin{document} \textbf{searchable text} \indent\Image{non-searchable-text.png} \textbf{searchable text} \indent\Image{non-searchable-text.png} \end{document}

