Page Navigation
After loading a PDF document, you can programmatically interact with it, which allows you to scroll to different pages or destinations. All of the interaction APIs are available on CPDFViewer
, which is the core PDF viewer.
- Scrolls to the specified page, and use the function CPDFViewer.GoToPage(int pageIndex)
.
- Goes to the specified destination, destinations include a page and a point on the page specified in page space, use function CPDFViewer.GoToPage(int pageIndex, Point pagePoint)
.
Outline
Outline allows users to quickly locate and link their point of interest within a PDF document. Each outline contains a destination or actions to describe where it links to. It is a tree-structured hierarchy, so function CPDFDocument.GetOutlineRoot()
must be called first to get the root of the whole outline tree before accessing the outline tree. Here, “root outline” is an abstract object which can only have some child outline without the next sibling outline and any data (includes outline data, destination data, and action data). It cannot be shown on the application UI since it has no data. You can also use the function CPDFDocument.CreateOutlineRoot()
to create a new root outline.
After the root outline is retrieved, the following functions can be called to access other outlines:
- To access the parent outline, use the function CPDFOutline.GetParent()
.
- To access the child outline, use the function CPDFDocument.GetOutlineList()
.
- To insert a new outline, use the function CPDFOutline.InsertChildAtIndex(CPDFDocument document, int index)
.
- To remove an outline, use the function CPDFOutline.RemoveFromParent(CPDFDocument document)
.
- To move an outline, use the function CPDFOutline.MoveChildAtIndex(CPDFDocument document, CPDFOutline child, int index)
.
Bookmarks
Since each bookmark is associated with a specific page, it provides the ability to link to a different page in a document allowing the user to navigate interactively from one part of the document to another.
- To access bookmarks, use function CPDFDocument.GetBookmarkList()
.
- To access a bookmark for page, use function CPDFDocument.BookmarkForPageIndex(int pageIndex)
.
- To add a new bookmark, use function CPDFDocument.AddBookmark(CPDFBookmark bookmark)
.
- To remove a bookmark, use function CPDFDocument.RemoveBookmark(int pageIndex)
.