4
votes

The below lines of code are used to open a PDF file at a particular page in C#. the code works absolutely fine for all the adobe version other than the latest, which is 11.

System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "AcroRd32.exe";
myProcess.StartInfo.Arguments = "/A \"page=2=OpenActions\" C:\\Jack and Jill.pdf";
myProcess.Start();

Can some one please help me out and let know what is special with adobe reader 11. Any help will be greatly appreciated.

The error is "There was an error opening this document. The file cannot be found." (THE FILE DOES EXIST)

P.S: I have uninstalled adobe 11 and installed adobe reader 10 and the code works absolutely fine then.

also the arguments when given from command line when Acrobat Reader 11 is installed works fine and opens PDF.

4
Is the process still called AcroRd32.exe?B L
What error message do you get?Esoteric Screen Name
@glace: yes the process is still called AcroRd32rookie_developer
Does that code work by manually running it in cmd?Despertar
Can you just invoke a static Process.Start(filename,arguments) instead of creating an object? Process.Start("C:\\example.pdf", "/A \"page=2=OpenActions\"); See if that launches Adobe 11 or not.B L

4 Answers

4
votes

Make sure u dont have spaces in the name of the file. it works if it has spaces in all other adobe readers but adobe reader 11 dosent support that.

Hope this helps

0
votes

According to the Parameters for Opening PDF Files, your arguments line should look like this:

myProcess.StartInfo.Arguments = "/A \"page=2\" C:\\example.pdf";
0
votes

Make sure that file C:\example.pdf exist. This error occurs when there is no file.

string pdfPath = @"C:\example.pdf";

if (System.IO.File.Exists(pdfPath))
{
     System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
     myProcess.StartInfo.FileName = "AcroRd32.exe";
     myProcess.StartInfo.Arguments = string.Format("/A \"page=2=OpenActions\" \"{0}\"", pdfPath);
     myProcess.Start();
}
0
votes

Open Parameters for Reader 11 have changed or been removed. Use Reader 10. I have asked Adobe for information on Open parameters for reader 11 but had no response.