11

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)

4

2 Answers 2

3

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?

enter image description here

\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},
    commentstyle=\color{black},
    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}
4
  • 1
    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. Commented Feb 26, 2012 at 19:59
  • 2
    @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.
    – yannisl
    Commented Feb 26, 2012 at 20:07
  • 1
    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 ;). Commented Feb 26, 2012 at 20:14
  • @GrzegorzWierzowiecki I would invest 2 minutes and get a trial version ; besides in Poland anything is possible;)
    – yannisl
    Commented Feb 26, 2012 at 20:22
1

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

1
  • 1
    Not really: "This option doesn’t invert pictures, nor does it really swap text and paper color." Commented Feb 27, 2012 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .