Some test text!
Xamarin / Guides
You can change the color themes inside document viewers.
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 color.
To set the color mode:
Find the constant value of the color mode
Color mode | Constant value |
---|---|
Normal color mode | PDFRasterizer.ColorPostProcessMode.e_postprocess_none |
Night mode | PDFRasterizer.ColorPostProcessMode.e_postprocess_night_mode |
Inverted color mode | PDFRasterizer.ColorPostProcessMode.e_postprocess_invert |
Custom color mode | PDFRasterizer.ColorPostProcessMode.e_postprocess_gradient_map |
Call SetColorPostProcessMode
.
Optionally, set the PDFViewCtrl
background color for the best visual result. You can set background color by calling SetClientBackgroundColor
(Xamarin.Android) or SetBackgroundColor
(Xamarin.iOS).
For example, set the background color to black for night mode:
// Xamarin.Android
mPdfViewCtrl.SetClientBackgroundColor(0, 0, 0, false);
// Xamarin.iOS
mPdfViewCtrl.SetBackgroundColor(0, 0, 0, false);
If you are using postprocess_gradient_map
, call PDFViewCtrl.SetColorPostProcessColors
to set the white and black points. For example, for a sepia effect, try:
// Xamarin.Android
var darkBrown = Android.Graphics.Color.Rgb(61, 38, 10);
var lightBrown = Android.Graphics.Color.Rgb(245, 224, 202);
mPdfViewCtrl.SetColorPostProcessColors(lightBrown, darkBrown);
// Xamarin.iOS
var darkBrown = new UIKit.UIColor(0.24f, 0.15f, 0.04f, 1.0f);
var lightBrown = new UIKit.UIColor(0.96f, 0.88f, 0.79f, 1.0f);
mPdfViewCtrl.SetColorPostProcessColors(lightBrown, darkBrown);
Update PDFViewCtrl
to redraw the contents:
mPdfViewCtrl.Update(true);
Sample result when using postprocess_gradient_map
and a light/dark brown for the white/black color:
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales