Skip to main content
Inspiring
Jan 31, 2022 2:18 PM UTC
Question

PDF Reader control (Windows, C#) - How to get current page number?

I built a six-panel PDF display app, with 6 instances of the PDF Reader COM control on a Windows Form, and everything works great.

When the program loads, it reads a settings file to open the last set of PDF files so the user can continue where he left off.

 

I use SetCurrentPage so the user can specify what page to start each PDF on. But when the app exits, I need to SAVE the new current page so the user doesn't have to do this manually.

 

In order to restore the last page in each PDF, I have to find out the current page of the PDF Reader controls.

 

The control exposes a .setCurrentPage method, but nothing to GET the current page number. The exposed methods and properties don't seem to provide any access to the current page number.

 

Is there a way to do this?

 

Two DLL's are resident in the project: AxInterop.AcroPDFLib.dll and Interop.AcroPDFLib.dll, if that's relevant.

 

Thanks in advance,

Allen

 

This topic is closed to new replies. Start a new post to keep the conversation going.

10 replies

Thom Parker
Community Expert
Community Expert
Jan 31, 2022 9:55 PM UTC

Get the AVPageView from the AVDoc, then use AVPageView.GetPage();

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Inspiring
Jan 31, 2022 10:07 PM UTC

Thanks, Thom,

Is this a COM object? I'm not sure how to include it in the VS IDE for C#.

Also, will there be an instance of AVPageView in every instance of the Reader control?

BTW, this is for internal noncommercial use (and I have a full CC license).

 

I've taken a look at the AVPageView online docs, but I haven't yet seen how to incorporate it into my project.

 

Translate
Thom Parker
Community Expert
Community Expert
Jan 31, 2022 10:38 PM UTC

Yes it is a COM object,or rather a COM interface. I may have been mistaken to have suggested it.  This part of the AcroExch API is only available through Acrobat Professional. It's not in Reader 😞  

 

Please see the reference for clarification:

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%2FIAC_DevApp_OLE_Support%2FUsing_OLE.htm

 

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Bernd Alheit
Community Expert
Community Expert
Jan 31, 2022 5:26 PM UTC

There is no method in the control for this.

Translate
Inspiring
Jan 31, 2022 6:34 PM UTC

Ouch. That's a major disappointment. Do you have any suggestions for a slightly more useful way to instantiate a PDF reader inside a Win desktop C# app?

Thanks.

Translate