private void ProcessNewPdf(FileInfo file)
{
string tiffFilePath = Path.Combine(file.DirectoryName, "convert.tif");
Logger.Instance.LogFormat(LogType.Trace, this, Properties.Resources.GhostscriptConvert, file.FullName);
try
{
GhostscriptImageDevice dev = new GhostscriptImageDevice();
dev.Device = "tiffgray";
dev.GraphicsAlphaBits = GhostscriptImageDeviceAlphaBits.V_4;
dev.TextAlphaBits = GhostscriptImageDeviceAlphaBits.V_4;
dev.Resolution = 300;
dev.InputFiles.Add(file.FullName);
dev.OutputPath = tiffFilePath;
dev.Process();
ProcessNewImage(new FileInfo(tiffFilePath));
file.Delete();
}
catch (GhostscriptException ex)
{
Logger.Instance.LogFormat(LogType.Error, this, Properties.Resources.GhostscriptConvertError);
Logger.Instance.LogException(this, ex);
string archivedFilePath = Path.Combine(_archivePath.FullName, file.Name);
MoveFileTo(file, archivedFilePath);
}
}