我想使用WinForms(C#)在指定目的地打开PDF文件.这是我的代码:
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();
Run Code Online (Sandbox Code Playgroud)
它总是打开第1页的文件,即使目标Test2位于第10页.它基本上忽略了目标参数.但是,如果我使用其他参数,如页码,它工作正常.例如:
myProcess.StartInfo.Arguments = "/A \"page=5=OpenActions\" C:\\example.pdf";
Run Code Online (Sandbox Code Playgroud)
将始终在第5页打开PDF文档.
在此先感谢您的帮助
我使用以下代码:
string strNamedDestination = "MyNamedDestination"; // Must be defined in PDF file.
string strFilePath = "MyFilePath.pdf";
string strParams = " /n /A \"pagemode=bookmarks&nameddest=" + strNamedDestination + "\" \"" + strFilePath + "\"";
Process.Start("AcroRd32.exe", strParams);
Run Code Online (Sandbox Code Playgroud)
请注意参数内的"/ n".它使Adobe始终打开一个新文档.否则,如果文档已经打开,则不会将其移动到正确的命名目标.这取决于您的应用程序所需的行为.
| 归档时间: |
|
| 查看次数: |
16137 次 |
| 最近记录: |