0

The accepted answer to this question regarding how to open a PDF to a specific page using C# is, in summary:

Process myProcess = new Process();    
myProcess.StartInfo.FileName = "acroRd32.exe"; //not the full application path
myProcess.StartInfo.Arguments = "/A \"page=2=OpenActions\" C:\\example.pdf";
myProcess.Start();

However, this answer appears to be incomplete. It works great if Adobe Reader (acroRd32.exe) is not already running, but if Reader is running, this code won't do anything (at least on my Windows 8.1 PC). So, how can you open in PDF to a specified page using C# (or VB.NET) regardless of whether Adobe Reader is already running?

Community
  • 1
  • 1
OfficeAddinDev
  • 1,105
  • 3
  • 15
  • 29

1 Answers1

0

Turns out the trick is to add the "/n" switch to the arguments string just before the PDF path as follows:

myProcess.StartInfo.Arguments = String.Format("/A ""zoom={0}&page={1}=OpenActions"" /n ""{2}", strZoom, strPage, strPath)

According to the Acrobat developer FAQ, the /n switch "Launches a separate instance of Acrobat or Adobe Reader, even if one is currently open." I cannot imagine a case where you wouldn't want to use this switch (when opening a PDF as described in the OP), so it is surprising that there is little mention of this switch in the dozens of proposed solutions on this topic.

OfficeAddinDev
  • 1,105
  • 3
  • 15
  • 29