2

当我的表单加载了以下代码时,我打开了一个 pdf 文件:

Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
process.StartInfo = startInfo;
startInfo.FileName = @"F:\STAGE\test.pdf";
process.Start();

这工作正常,但现在我想打开一个特定的页面。例如文件 test.pdf 的第 5 页?有人有想法吗?尝试了一些东西,但没有用!

谢谢!

4

5 回答 5

2

尝试

process.StartInfo.Arguments = "/A \"page=n\" \"F:\\STAGE\\test.pdf"";

更改n为您想要的页码

于 2014-03-28T13:25:36.823 回答
0

像这里建议的那样称呼它:Adobe Reader Command Line Reference

所以它会是:

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = "EXE_PATH\\AcroRd32.exe";
    startInfo.Arguments = "/A \"page=PAGE_NUM\" \"FILE_PATH\"";
    Process.Start(startInfo);
于 2014-03-28T13:25:48.270 回答
0

结帐:http ://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

它解释了 Adob​​e Reader 可以接收哪些参数。

它有一个 Page 参数。

您的代码必须是:

Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
process.StartInfo = startInfo;
startInfo.Arguments = "/A \"page=N\"";
startInfo.FileName = @"F:\STAGE\test.pdf";
process.Start();

其中 N 是您的页码。

于 2014-03-28T13:28:05.323 回答
0

你可以试试这段代码。

  Process myProcess = new Process();
  myProcess.StartInfo.FileName = @"C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe";
  myProcess.StartInfo.Arguments = "/A \"page={pagenum}\" \"c:\\Classic\\Manual\\DocumentationManual.pdf\"";
  myProcess.Start();

请根据您的目录更改 AcroRd32.exe 的路径。

谢谢

于 2016-07-18T14:41:09.227 回答
0

Try this. Note: you must have acrobat reader installed in your pc before you can use axAcroPDF .

            int n = 5; //page number
            string filePath = "F:\STAGE\test.pdf";

            axAcroPDF1.LoadFile(filePath);
            axAcroPDF1.setCurrentPage(n); 
于 2016-08-28T15:41:10.260 回答