The graphicx
package provides some very useful options for its all-powerful \includegraphics
command, namely the trim
and clip
options.
With these, it's easily possible to trim and clip an included image, and if that image is a PDF file, the text of it is still selectable. Consider this simple example. Create a file called input.tex
with the following contents, and run pdflatex
on it:
\documentclass{standalone}
\begin{document}
Hello world!
\end{document}
Now, in a second file, the output of the first one can be easily included, trimmed and clipped like this:
\documentclass{article}
\usepackage{graphicx}
\begin{document}
here comes the text: \fbox{\includegraphics[trim=0em 0cm 1cm 0cm,clip=true]{input}}
\end{document}
However, the clip
option doesn't seem to actually remove the contents from the PDF file, but rather hide them - they can still be accessed when selecting the text passages by mouse:
That is not very nice, especially if the clipped sections of the input.pdf
include sensitive information that the receipients of the final file are not allowed to access. Is there any magical includegraphics
option to solve this problem?
censor
package, though it won't help you here.tex
file withstandalone
and include,clip
andtrim
the input as needed, then (2) callpdfcrop
to get rid of any additional whitespace, then (3) convert it withpdf2ps
and finally (4) convert it back withps2pdf
. This works to remove the elements outside the bounding box & keeps the image as a vector graphic, but is cumbersome as hell.