Reconfig QPDF to ignore chatter on output
This commit is contained in:
@@ -176,7 +176,7 @@ namespace Swarmops.Frontend.Socket
|
||||
|
||||
process.WaitForExit();
|
||||
|
||||
if (process.ExitCode != 0)
|
||||
if (process.ExitCode == 2)
|
||||
{
|
||||
// Bad PDF file
|
||||
failCount++;
|
||||
@@ -190,9 +190,12 @@ namespace Swarmops.Frontend.Socket
|
||||
|
||||
using (StreamReader pageCountReader = new StreamReader(pageCountFileName))
|
||||
{
|
||||
string pageCountString = pageCountReader.ReadToEnd().Trim();
|
||||
debugWriter.WriteLine("{0:D2}%, page count is '{1}'", progress, pageCountString);
|
||||
currentFilePageCount = Int32.Parse(pageCountString);
|
||||
string line = pageCountReader.ReadLine().Trim();
|
||||
while (line.StartsWith("WARNING") || line.StartsWith("qpdf:"))
|
||||
{
|
||||
line = pageCountReader.ReadLine().Trim(); // ignore warnings and chatter
|
||||
}
|
||||
currentFilePageCount = Int32.Parse(line);
|
||||
debugWriter.WriteLine("{0:D2}%, parsed to int as {1}", progress, currentFilePageCount);
|
||||
currentFilePageStepMilli = progressFileStep * 1000 / currentFilePageCount;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace Swarmops.Frontend.Automation
|
||||
process.WaitForExit();
|
||||
int pdfPageCount = 0;
|
||||
|
||||
if (process.ExitCode != 0)
|
||||
if (process.ExitCode == 2) // error code for qpdf
|
||||
{
|
||||
// Bad PDF file
|
||||
FilesStatus errorStatus = new FilesStatus(fullName, -1); //file.ContentLength);
|
||||
@@ -301,10 +301,15 @@ namespace Swarmops.Frontend.Automation
|
||||
|
||||
using (StreamReader pageCountReader = new StreamReader(pageCountFileName))
|
||||
{
|
||||
string pageCountString = pageCountReader.ReadToEnd().Trim();
|
||||
pdfPageCount = Int32.Parse(pageCountString);
|
||||
string line = pageCountReader.ReadLine().Trim();
|
||||
while (line.StartsWith("WARNING") || line.StartsWith("qpdf:"))
|
||||
{
|
||||
line = pageCountReader.ReadLine().Trim(); // ignore warnings and chatter
|
||||
}
|
||||
pdfPageCount = Int32.Parse(line);
|
||||
}
|
||||
|
||||
|
||||
File.Delete(pageCountFileName);
|
||||
|
||||
if (pdfPageCount < 10)
|
||||
|
||||
Reference in New Issue
Block a user