Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
1  
It will likely be most efficient to do this with ghostscript. –  qubyte Feb 26 '12 at 14:53
1  
For local viewing I use xpdf -rv or invert entire screen with xcalib -i -a. –  Grzegorz Wierzowiecki Feb 26 '12 at 20:08
    
I'd like to invert whole pdf-s. Ghostscript sounds interesting, but I'm afraid of loosing hyperref links. –  Grzegorz Wierzowiecki Feb 26 '12 at 20:09
    
Possible duplicate of: tex.stackexchange.com/questions/40495/… –  johntex Mar 2 at 11:42

2 Answers 2

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}
share|improve this answer
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. –  Grzegorz Wierzowiecki Feb 26 '12 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. –  Yiannis Lazarides Feb 26 '12 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 ;). –  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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.