3

I open a pdf file when my form is loaded with the following code:

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

This works fine but now I want to open a specific page. For example page number 5 of the document test.pdf? Does any one have an idea? Tried some stuff but dind't work!

Thanks!

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
thijs1095
  • 89
  • 2
  • 10

5 Answers5

3

Try

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

changing n to the page number you want

Ted
  • 3,985
  • 1
  • 20
  • 33
1

Checkout this : http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

It explain what arguments Adobe Reader can receive.

And it has a Page argument.

Your code must be :

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

Where N is your page number.

Floc
  • 668
  • 8
  • 16
0

call it like what was suggested here: Adobe Reader Command Line Reference

So it would be:

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = "EXE_PATH\\AcroRd32.exe";
    startInfo.Arguments = "/A \"page=PAGE_NUM\" \"FILE_PATH\"";
    Process.Start(startInfo);
Community
  • 1
  • 1
rca
  • 196
  • 1
  • 9
0

you can try this code.

  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();

please change the path of AcroRd32.exe as per your directory.

Thanks

purav topiwala
  • 69
  • 1
  • 10
  • Does this extract a specific page from the PDF? What if you wanted to extract different pages that are not sequential? – Azurespot Apr 25 '20 at 00:14
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);