Regarding 1: I do not know if and how this is possible, would be happy to learn about it. I guess the transparency has to be already in the PDF.
Regarding 2: This can be done using \foreach
from the TikZ/PGF package and and \includegraphics<+>
. I usually put all frames of an animation as pages into a single PDF, so I can write:
\usepackage{pgffor} % if you do not already include tikz
\begin{frame}{Animation}
\foreach \p in {1,...,10}{%
\includegraphics<+>[page=\p, width=\textwidth]{animation.pdf}
}
\end{frame}
If you do not have a single PDF, but a number of PDF files you might use pdftk
to concatenate them. Alternatively, the following should work as well (I am not able to test this right now):
\usepackage{pgffor} % if you do not already include tikz
\begin{frame}{Animation}
\foreach \f in {frame1.pdf, frame2.pdf, frame3.pdf}{%
\includegraphics<+>[width=\textwidth]{\f}
}
\end{frame}
A very nice thing property of this approach is that it becomes pretty easy to specify a different sequence (usually one containing fewer slides) for the handout version.
Easy case with uncolored PDF and pdfTeX (unhappily very seldom):
The PDF file contains some drawings without explicit color settings and
the image will be included by the pdftex driver of the graphics package.
The following file generates such an image:
\documentclass{article}
\usepackage[active,tightpage,floats]{preview}
\begin{document}
\begin{figure}
\Huge\bfseries\sffamily
\setlength{\fboxrule}{2pt}
\fbox{Hello World}
\end{figure}
\end{document}
The following file includes the image (t.pdf) and changes its colors.
\documentclass{article}
\usepackage{color}
\usepackage{graphicx}
\pagecolor{black}
\color{white}
\begin{document}
\Huge\bfseries
\noindent
Some text.\\
\includegraphics{t.pdf}\\
Some text.\\
\textcolor{yellow}{\includegraphics{t.pdf}}\\
Some text.
\end{document}
This trick does not work with other drivers, because the other drivers
normalize the color before the image is included. If pdftex.def is given
the option resetcolor
then the color is set to \normalcolor
during
image inclusion.
Manual color fixes
With some knowledge of the internals structures the PDF file can be fixed
manually. First the compressed page contents needs to be uncompresed, e.g.:
pdftk test.pdf cat output test-uncompress.pdf uncompress
Then the pages content streams need to be identified and the color operations
can be either changed or deleted (by overwriting with spaces). Best is not to
change the size of the object otherwise the file offsets of the objects in
the xref table needs to be updated. BTW, also PDF (or PS) use %
as comment char.
Then the file can be recompressed.
Or the PDF file is converted to PostScript (e.g. with pstopdf from xpdf). Editing
is easier if changing the file size does not matter.
PostScript does not have a xref table. However, the detection of
the color operators can be more difficult, because often they are renamed or
hidden in procedures. Unlike PDF, PostScript is a programming language.
Programs for processing vector images like Inkscape
If the PDF file can be successfully imported in Inkscape or similar programs,
the colors could be changed there.
Bitmap conversion
As last resort the image can be converted to a bitmap image (ghostscript and other convertes). That means quality
loss because of pixel data. But many image processing programs should be able
to change the colors.
Generating inverse colors can even be done by a feature of the PDF format that
is supported by pdftex.def. Colors can be inverted via the /Decode
array (except
images with indexed color spaces). Each
color component has then two float values inbetween 0 and 1.
Thus the number of color components must be known (Mono: 1, RGB: 3, CMYK: 4)
\includegraphics[decodearray=1 0 1 0 1 0]{rgbimage.png}
For example, the ghostscript device png16m
can be used to generate PNGs for
this usage. More details are explained in the PDF reference. The options of
pdftex.def are shortly explained in the file itself.
Best Answer
I'm not sure about turning anything to transparent in a PDF. PDF is not an image format, so I guess the only way is to remove the background object entriely from the pages. You could do that manually (on every page) with Acrobat professional (and probably also some free pdf editors), but if you're lucky, the following may work:
qpdf -qdf file.pdf file-redable.pdf
.Look in there for the background object. (Luck needed at this point) More often than not, it will look somewhat like this:
That is, a filled rectangle large enough to cover the whole page.
Experimentally remove it.
fix-qdf file-redable.pdf
.sed
, for instance.