Creating pdf with inverted colors using pdflatex (like white on black etc)

Is there a simple way of a creating PDF with inverted colours?

A partial solution would be just changing font to white and making the background black.

Is there simple "full" solution of inverting whole PDF pages? (including colors in lstlistings, images, etc)

You can set a pagecolor with the background package and the page color using the color command. You will need to pass the values onto setlistings as well. Color inversion of images is perhaps not possible although you can manipulate them as well. What do you exactly want the images to look like?

\documentclass{article}
\usepackage{graphicx}
\usepackage{listings}
\lstnewenvironment{teX}[1][]
{\lstset{language=[LaTeX]TeX}\lstset{escapeinside={(*@}{@*)},
numbers=left,numberstyle=\normalsize,stepnumber=1,numbersep=5pt,
breaklines=true,
%firstnumber=last,
%frame=tblr,
framesep=5pt,
basicstyle=\normalsize\ttfamily,
showstringspaces=false,
keywordstyle=\ttfamily\color{orange},
%identifierstyle=\ttfamily,
stringstyle=\color{maroon},
rulecolor=\color{gray!10},
xleftmargin=0pt,
xrightmargin=0pt,
aboveskip=\medskipamount,
belowskip=\medskipamount,
backgroundcolor=\color{black}, #1
}}
{}
\usepackage{hyperref}
\usepackage{background}
\SetBgContents{}
\begin{document}
\pagecolor{black}
\color{green}
\begin{teX}
\documentclass{article}
\usepackage{graphicx}
\usepackage{listings}
\lstnewenvironment{teX}[1][]
\end{teX}
\end{document}

• I just would like to invert colors of whole pages. This can be done by generating pdf first and than including it and reverting colors. I mentioned about images, just because I don't want to change settings of each used object, but to have a kind of global switch. – Grzegorz Wierzowiecki Feb 26 '12 at 19:59
• @GrzegorzWierzowiecki You will then have to look at external tools, or add a switch as an option when you generate the pdf i.e., the pagecolor and color can be set to be activated via an if statement. Best tool externally is Acrobat Professional. – Yiannis Lazarides Feb 26 '12 at 20:07
• It's not available for Linux and it's 270$for commercial use, for Teachers is 120$. I will not pay 120\$, just for inverting colors in my pdf ;). – Grzegorz Wierzowiecki Feb 26 '12 at 20:14
• @GrzegorzWierzowiecki I would invest 2 minutes and get a trial version ; besides in Poland anything is possible;) – Yiannis Lazarides Feb 26 '12 at 20:22

A better solution (perhaps the best solution) is to use crop package with invert option.

• Not really: "This option doesn’t invert pictures, nor does it really swap text and paper color." – Martin Schröder Feb 27 '12 at 7:36