So I have code to open a pdf programmatically. the code opens adobe reader just fine, but I get a dialog that pops up that says the file doesn't exsit. The problem is though that I can browse to the exact path that is being used to try and open the pdf in a windows explore, plus there is an if statement for if the file exists. So why isn't adobe opening the pdf?
the path for the Adobe .exe on the proc.StartInfo.FileName is correct.
I found this link: https://visibleprocrastinations.wordpress.com/2009/08/20/there-was-an-error-opening-this-document-file-cannot-be-found-acrobat-reader/ but I don't know if it still applies
PDF file path:
C:\Users\Printer\SharePoint\Partners - Doc\McG\Labels\TR109897\eLabels_TR109897.pdf
Heres the code I'm using:
Process proc = new Process();
FileInfo file = new FileInfo(filepath);
if (file.Exists)
{
//Define Location of adobe reader/command line
proc.StartInfo.FileName = @"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.Arguments = string.Format(@"{0}", file.FullName);
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
if (proc.HasExited == false)
proc.WaitForExit(10000);
proc.Close();
return true;
}