Skip to content
Guides

Page Navigation

After loading and displaying a PDF document in the CPDFViewer, users can navigate to different pages or positions within the document by adjusting the display area.

This example shows how to navigate to specific pages and positions within pages:

swift
// Navigate to the first page.
pdfview.go(toPageIndex: 0, animated: false)

// Navigate to a specific position on the first page.
if let page = pdfView.document.page(at: 0) {
    pdfview.go(to: CGRect(x: 100, y: 100, width: 100, height: 100), on: page, animated: true)
}
objective-c
// Navigate to the first page.
[pdfview goToPageIndex:0 animated:NO];

// Navigate to a specific position on the first page.
[self.pdfView goToRect:CGRectMake(100, 100, 100, 100) onPage:[pdfView.document pageAtIndex:0] animated:YES];

About Navigation position coordinates

In PDF, positions are typically described using coordinates. PDF uses points as the unit of measurement for positions and dimensions. One point is equal to 1/72 inch, so coordinates and dimensions in a PDF document are based on points.

In the page navigation functionality, with the origin at the top-left corner (0,0), the positive X direction extends horizontally to the right, and the positive Y direction extends vertically downward. Therefore, the coordinates for a specific position can be represented as (X, Y), where X is the horizontal coordinate and Y is the vertical coordinate.

For example, a point located at the bottom-left corner of a PDF page might have coordinates (0, 792), where the page height is 792 points (if the page size is 8.5 x 11 inches, then 792 points correspond to 11 inches).