Skip to content

Commit

Permalink
Issue #17
Browse files Browse the repository at this point in the history
  • Loading branch information
tuespetre committed Jun 3, 2014
1 parent 151ab85 commit c16f002
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 9 additions & 1 deletion Pechkin/GlobalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}

/// <summary>
/// Whether to print in color or grayscale. (Default: color)
/// </summary>
[WkhtmltopdfSetting("colorMode")]
public DocumentColorMode ColorMode { get; set; }

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions Pechkin/SettingApplicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down

0 comments on commit c16f002

Please sign in to comment.