Windows
ComPDFKit PDF SDK
Guides

PDF Navigation

 

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, use 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 allow 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 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 function CPDFDocument.CreateOutlineRoot() to create a new root outline.

 

After the root outline is retrieved, following functions can be called to access other outline:

- To access the parent outline, use function CPDFOutline.GetParent().

- To access the child outline,use function CPDFDocument.GetOutlineList().

- To insert a new outline, use function CPDFOutline.InsertChildAtIndex(CPDFDocument document, int index).

- To remove an outline, use function CPDFOutline.RemoveFromParent(CPDFDocument document).

 - To move an outline, use 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).