[Tex/LaTex] How to change white background of an included PDF to transparent


I have an external 100 pages PDF document (not created by pdflatex) that I \includegraphics page-wise into a beamer presentation. The external PDF document employs white as page color, but I need the background to be transparent.

Ideally, this would be an option one could pass to \includegraphics – which I doubt to exist. However, I would also be open for some process involving external tools (pdftk, pdfjam, ImageMagick, Acrobat…).

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:

  1. Convert your PDF into something readable with qpdf -qdf file.pdf file-redable.pdf.
  2. Look in there for the background object. (Luck needed at this point) More often than not, it will look somewhat like this:

    10 765.75 591.75 -729.75 re

    That is, a filled rectangle large enough to cover the whole page.

  3. Experimentally remove it.

  4. Fix the resulting pdf with fix-qdf file-redable.pdf.
  5. Try whether it worked ;-)
  6. If you found the right object to remove, you can remove it in all places simultaneously with sed, for instance.