views:

1150

answers:

3

Hello,

I would like to open a PDF file at named destination using WinForms (C#). Here is my code:

System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "Acrobat.exe";
myProcess.StartInfo.Arguments = "/A \"nameddest=Test2=OpenActions\" C:\\example.pdf";
myProcess.Start();

It always opens the file at page 1 even having the destination Test2 at page # 10. It basically ignores the destination parameter. However if I use another parameter like the page number it works fine. For example:

myProcess.StartInfo.Arguments = "/A \"page=5=OpenActions\" C:\\example.pdf";

will always open the PDF document at page 5.

Thanks in advance for your help

A: 

Have you set up the destinations? You need to be have the standard or professional versions of Adobe Acrobat in order to do this:

http://kb2.adobe.com/cps/317/317300.html

BFree
Yes, I'm using Adobe Acrobat 8 Standard Version 1.8.3. Inside Adobe all of the destinations seems fine. Clicking on any of them will navigate through the document.
+1  A: 

Regarding the Adobe documentation when opening a PDF document from a command shell, you can pass the parameters to the open command using the /A switch using the following syntax:

myProcess.StartInfo.Arguments = "/A \"nameddest=Test2=OpenActions\" C:\\example.pdf";

If I omit the OpenActions parameter everything works fine like:

myProcess.StartInfo.Arguments = "/A \"nameddest=Test2\" C:\\example.pdf";

I'm not sure why the OpenActions breaks opening the file but with omitting it works fine.

A: 

Adobe Reader has a few bugs regarding opening to named destinations. Take a look at http://xenon.arcticus.com/open-pdf-named-destination-dde-c-c for some information and workarounds.

Gloria Sadowski