Skip to content

Commit c16f002

Browse files
author
tuespetre
committed
Issue #17
1 parent 151ab85 commit c16f002

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Pechkin/GlobalSettings.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,18 @@ public enum PaperOrientation
4141
[WkhtmltopdfSetting("collate")]
4242
public bool? Collate { get; set; }
4343

44+
[WkhtmltopdfSetting("colorMode")]
45+
internal string StringColorMode
46+
{
47+
get
48+
{
49+
return this.ColorMode == DocumentColorMode.Color ? "grayscale" : "color";
50+
}
51+
}
52+
4453
/// <summary>
4554
/// Whether to print in color or grayscale. (Default: color)
4655
/// </summary>
47-
[WkhtmltopdfSetting("colorMode")]
4856
public DocumentColorMode ColorMode { get; set; }
4957

5058
/// <summary>

Pechkin/SettingApplicator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ public static void ApplySettings(IntPtr config, object settings, bool global = f
4747

4848
private static string GetStringValue(PropertyInfo property, object value)
4949
{
50-
var u = Nullable.GetUnderlyingType(property.PropertyType);
50+
var type = property.PropertyType;
5151

52-
if (property.PropertyType == typeof(double?))
52+
if (type == typeof(double?) || type == typeof(double))
5353
{
5454
return ((double?)value).Value.ToString("0.##", CultureInfo.InvariantCulture);
5555
}
56-
else if (property.PropertyType == typeof(bool?))
56+
else if (type == typeof(bool?) || type == typeof(bool))
5757
{
5858
return ((bool?)value).Value ? "true" : "false";
5959
}

0 commit comments

Comments
 (0)