From c16f002a394262b6b4ab71bfbf5f57ea529221da Mon Sep 17 00:00:00 2001 From: tuespetre Date: Tue, 3 Jun 2014 14:49:18 -0500 Subject: [PATCH] Issue #17 --- Pechkin/GlobalSettings.cs | 10 +++++++++- Pechkin/SettingApplicator.cs | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Pechkin/GlobalSettings.cs b/Pechkin/GlobalSettings.cs index 292f6c1..4aec0ed 100644 --- a/Pechkin/GlobalSettings.cs +++ b/Pechkin/GlobalSettings.cs @@ -41,10 +41,18 @@ public enum PaperOrientation [WkhtmltopdfSetting("collate")] public bool? Collate { get; set; } + [WkhtmltopdfSetting("colorMode")] + internal string StringColorMode + { + get + { + return this.ColorMode == DocumentColorMode.Color ? "grayscale" : "color"; + } + } + /// /// Whether to print in color or grayscale. (Default: color) /// - [WkhtmltopdfSetting("colorMode")] public DocumentColorMode ColorMode { get; set; } /// diff --git a/Pechkin/SettingApplicator.cs b/Pechkin/SettingApplicator.cs index 60f24d1..6200ebc 100644 --- a/Pechkin/SettingApplicator.cs +++ b/Pechkin/SettingApplicator.cs @@ -47,13 +47,13 @@ public static void ApplySettings(IntPtr config, object settings, bool global = f private static string GetStringValue(PropertyInfo property, object value) { - var u = Nullable.GetUnderlyingType(property.PropertyType); + var type = property.PropertyType; - if (property.PropertyType == typeof(double?)) + if (type == typeof(double?) || type == typeof(double)) { return ((double?)value).Value.ToString("0.##", CultureInfo.InvariantCulture); } - else if (property.PropertyType == typeof(bool?)) + else if (type == typeof(bool?) || type == typeof(bool)) { return ((bool?)value).Value ? "true" : "false"; }