Created
March 27, 2015 12:16
-
-
Save maleadt/ee1ab7e3127672395ad2 to your computer and use it in GitHub Desktop.
LaTeX macro to obfuscate text as an image (to prevent selecting, parsing, ...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\makeatletter | |
\newcount\@imagecount | |
\newcommand\showasimage[1]{% | |
\global\advance\@imagecount 1 | |
\edef\x{image-\the\@imagecount}% | |
\immediate\write18{echo '\unexpanded{\font\1=}\fontname\font' > \x.tex}% | |
\immediate\write18{echo '\unexpanded{\1#1\nopagenumbers\bye}' >> \x.tex}% | |
\immediate\write18{pdftex \x.tex}% | |
\immediate\write18{pdf2ps -dNoOutputFonts \x.pdf \x.ps} | |
\immediate\write18{ps2pdf \x.ps \x.pdf} | |
\immediate\write18{pdfcrop --hires \x.pdf \x.pdf} | |
\settodepth{\@tempdima}{#1}% | |
\raisebox{-\the\@tempdima}{\includegraphics{\x.pdf}}% | |
} | |
\AtEndDocument{% | |
\loop | |
\immediate\write18{rm image-\the\@imagecount.*}% | |
\advance\@imagecount-1 | |
\ifnum\@imagecount>0\repeat | |
} | |
\makeatother |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that this requires passig
--shell-escape
topdflatex
.