Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Rotativa.AspNetCore/WkhtmlDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
}
}

Expand Down