How do I invert the colors of a PDF when displaying it?


I want to display PDFs in “night mode”, where colors are all inverted — black is white, white is black, etc. Is there an easy way to do so with PDFNet?


There are several ways you could invert all colors of a page.

Probably the easiest is just to add a white rectangle with a blend mode of Difference, which will cause all colours to display their inverse. (I’ve attached an example PDF with just such an annotation.) The PDFNet Android SDK makes it easy to add new custom annotations, so it would be possible to add a button to invert the colours of the page by adding a page-sized rectangle.

That said, there are many other methods for inverting colours if this one is problematic, such as directly editing the colours of each PDF element (

In PDFNet versions 6.3 or above, you can also use the PDFViewCtrl.SetColorPostProcessMode method to invert colors (for night mode).

For example, this method on iOS is documented at