1

The following TeX code is intended to change the background color of an external pdf file by using the pdfpages package, but it does not work for me. Does it work at all?

\documentclass{minimal}
\usepackage{xcolor}
\pagecolor[HTML]{B0A030}
\usepackage{pdfpages}
\begin{document}
\includepdf[fitpaper,pages=-]{external/notes.pdf}
\end{document}
Stephen
  • 14,890
Nimonika
  • 133
  • It works for me. What distribution and version are you using? – N.N. Dec 26 '11 at 08:12
  • I am using all the latest versions of everything, but it seems that the problem is actually with the way the original pdf file is produced as it works for some files and not for others. Ironically in the end I got the background color of the original file changed using the accessibility option in acrobat reader (9.0 +). This seems like a better option if you want to change the background color of all pages. I found the solution here link – Nimonika Dec 26 '11 at 08:33
  • Could you please show how to produce an external pdf that does not work here? – N.N. Dec 26 '11 at 08:36
  • Unfortunately the code that does not work is the same as the code that works. I think it depends on the way the pdf was produced in the first place. The file I was trying to change the background color of is a very old file (6 years +) and I do not know how that was produced. – Nimonika Dec 26 '11 at 08:41
  • @user10211: If you are using Mac OS then (right-click or ctl-click) on the pdf file. Select Get info. Note the version number under more info. Now go to http://en.wikipedia.org/wiki/Portable_Document_Format and check and see what versions are working and what versions are not working. This might help in this conversation. – Sony Dec 26 '11 at 14:52
  • 9
    If the old PDF file has already a background color, it's impossible to change it by superimposing the pages to a differently colored background. The method in your example will work only if the old PDF file has no background color. – egreg Dec 26 '11 at 15:10
  • 1
    In order for this to be resolved, post notes.pdf somewhere for people to download and experiment with. Try FileDropper or DropBox. – Werner Dec 26 '11 at 21:50

2 Answers2

4

As egreg notes in his comment, it will not be possible to change the background of the pdf file if the file has non transparent background to start with. In that case, I think the only way to do it is edit the file in a pdf editor (Adobe Acrobat, od pdfedit on linux, and either change the color of the background element on each page, or delete each background element, and then use pdfpages to change the background color.

Jan Hlavacek
  • 19,242
3

Instead of using pdfpages to change the background colour, you may draw a white box around it in beamer:

\colorbox{white}{\includegraphics{your-pdf-figure}}

Read more here: ADDING white background to an image?