Hi All,
Just wanted to let you know that I was having this same problem. In my case I had a Ghost Script making a copy of the the file before my MODI routines worked on the file. The error is was getting was IO Error with no explanation other than that. I removed my Ghost Script routines and my MODI routines no longer errored out. To get around this I had the Ghost Scirpt routines refresh the state of the file after they had completed their processing.
This is the Ghost Script routine: (input.Refresh(); is the code that refreshes the file state)
private string ConvertSingleImage(string filename)
{
bool Converted = false;
//Setup the converter
converter.OutputToMultipleFile =
false;
converter.FirstPageToConvert = -1;
converter.LastPageToConvert = -1;
converter.FitPage =
true;
//converter.JPEGQuality = (int)numQuality.Value;
converter.OutputFormat =
FileExtentionDevice.tifflzw.ToString();
System.IO.
FileInfo input = new FileInfo(filename);
string output = string.Format("{0}\\{1}{2}", input.Directory, input.Name.Replace(".pdf",""), "." + fileExtension.tif.ToString());
//If the output file exist alrady be sure to add a random name at the end until is unique!
while (File.Exists(output))
{
output = output.Replace(
"." + fileExtension.tif.ToString(), string.Format("{1}{0}", "." + fileExtension.tif.ToString(), DateTime.Now.Ticks));
}
Converted = converter.Convert(input.FullName, output);
input.Refresh();
return output;
}