Some test text!

Page coloring mode

In this document
chevron_rightSetting the color mode

PDFViewCtrl has three special color modes: night mode, inverted color mode, and custom color mode. In night mode, colors are adjusted to improve reading at night, in inverted color mode, all colors are inverted, and in custom color mode, you can set a custom color for text and the background colour.

Color modes from left to right: normal color mode, inverted color mode, night mode and custom color mode.

linkSetting the color mode

To set the color mode:

  1. Find the constant value of the color mode

Color modeConstant value
Nomal color modee_ptpostprocess_none
Night modee_ptpostprocess_night_mode
Inverted color modee_ptpostprocess_invert
Custom color modee_ptpostprocess_gradient_map
  1. Call setColorPostProcessMode(_ mode: PTColorPostProcessMode).

  2. Optionally, set the PTPDFViewCtrl background color for the best visual result. You can set background color by calling setBackgroundColor(_ r: UInt8, g: UInt8, b: UInt8, a: UInt8)).

    For example, set the background color to black for night mode:

  3. If you are using e_ptpostprocess_gradient_map, call setColorPostProcessColors(_ white_color: UIColor!, black_color: UIColor!) to set the white and black points. For example, for a sepia effect, try:

  4. Update PDFViewCtrl to redraw the contents:


Sample result when using e_ptpostprocess_gradient_map and a light/dark brown for the white/black color: