
Adobe Acrobat SDK
Working with Page Views and Contents
Developing Plug-ins and Applications
About page views 124
About page views
A page view is represented by an
AVPageView
object. To create an
AVPageView
object, invoke the
AVDocGetPageView
method. For information, see
Displaying page views
.
Using
AVPageView
methods, you can perform page-view tasks such as:
●
Displaying a page.
●
Selecting a zoom factor.
●
Scrolling the displayed page.
●
Highlighting one or more words.
●
Controlling screen redrawing.
●
Traversing the view stack that records where users have been in a document.
Note:
To control the size of the page view, you can invoke the
AVWindowSetFrame
and
AVDocSetSplitterPosition
methods. For information about these methods, see the
Acrobat
and PDF Library API Reference
.
Displaying page views
Using the Acrobat core API, you can programmatically display a page view by performing the following
tasks:
1. Create an
AVDoc
object that represents the PDF document that contains the page on which the page
view is based. For information, see
“Opening PDF documents” on page 72
.
2. If desired, ensure that the specified page number does not exceed the number of pages located in the
document. Convert the
AVDoc
object to a
PDDoc
object by invoking the
AVDocGetPDDoc
method.
This method requires an
AVDoc
and returns a
PDDoc
object. Get the total number of pages located
within the document by invoking the
PDDocGetNumPages
method. This method requires a
PDDoc
object and returns an
ASInt32
object representing the number of pages within the document.
3. Create an
AVPageView
object that represents the page view by invoking the
AVDocGetPageView
method. This method requires an
AVDoc
object and returns an
AVPageView
object.
4. Specify the page view’s page number by invoking the
AVPageViewGoTo
method. This method
requires an
AVPageView
object that represents the page view and an
ASInt32
object that specifies
the page number. The page number uses a zero-based index value. Therefore the value of the first page
is
0
.
5. Display the page view by invoking the
AVPageViewDrawNow
method and passing the
AVPageView
object. When you invoke a method that affects a page view, you must invoke this method to redraw the
page and display the page view. Otherwise, changes to a page view are not displayed.
The following code example displays a page view that is based on an
AVDoc
object named
myDocument
.
The specified page of the page view is 40 (which displays page 41). For information about creating an
AVDoc
object, see
“Opening PDF documents” on page 72
.