diff --git a/Rotativa.AspNetCore/WkhtmlDriver.cs b/Rotativa.AspNetCore/WkhtmlDriver.cs
index 48b3bb6..0d3aee5 100644
--- a/Rotativa.AspNetCore/WkhtmlDriver.cs
+++ b/Rotativa.AspNetCore/WkhtmlDriver.cs
@@ -21,7 +21,7 @@ protected static byte[] Convert(string wkhtmlPath, string switches, string html,
// "-q" - silent output, only errors - no progress messages
// " -" - switch output to stdout
// "- -" - switch input to stdin and output to stdout
- switches = "-q " + switches + " -";
+ switches = switches + " -";
// generate PDF from given HTML string, not from URL
if (!string.IsNullOrEmpty(html))
@@ -68,7 +68,7 @@ protected static byte[] Convert(string wkhtmlPath, string switches, string html,
}
}
- string error = proc.StandardError.ReadToEnd();
+ var error = proc.StandardError.ReadToEnd();
if (ms.Length == 0)
{
@@ -77,7 +77,9 @@ protected static byte[] Convert(string wkhtmlPath, string switches, string html,
proc.WaitForExit();
- return ms.ToArray();
+ if(proc.ExitCode == 0 || proc.ExitCode == 2)
+ return ms.ToArray();
+ throw new Exception(error);
}
}