8' Converts a point in a page space to a point in screen space.
9view.ConvPagePtToScreenPt(x, y, page)
10
11' Converts a point in screen space to a point in a page space.
12view.ConvScreenPtToPagePt(x, y, page)
Understanding coordinates
PDF documents have their own coordinate system, which is different from the screen coordinate system of the viewer. For instance, when asking for the position of an annotation element in a PDF document using the Apryse API, the position is given in PDF page coordinates instead of screen coordinates.
In a PDF document, the location origin (0, 0) is at the bottom left corner of the PDF page. The x axis is positive horizontally to the right and y axis is positive vertically upward. A page location point represents a point in page coordinates. Page points by default is 1⁄72 inch. So an 8.5 x 11 inch page would be 612 x 792 points.
A PDF page can have a rotation associated with it. In this case, the location origin (0, 0) may no longer correspond to the bottom left corner of the page.
For example, here is the page above rotated 90 degrees clockwise. Notice how the location origin (0, 0) is now at the top left corner of the viewport.
Screen coordinates
In the PDFViewCtrl class, the location points of the viewer are measured in screen coordinates. Location origin (0, 0) is at the top left corner of the viewport. The x axis is positive horizontally to the right and the y axis is positive vertically downward. A screen location point represents a point in screen coordinates.
Since screen coordinates align to the viewer, if PDFViewCtrl zooms in, then an element's screen coordinates may change.
For example, here are two screen captures of the same annotation element before and after zooming in, and a table showing how its screen coordinates change.
left (x1)
bottom (y1)
right (x2)
top (y2)
Before zoom in
215.8
1148.8
805.8
734.6
After zoom in
2.4
1130.0
986.8
638.8
Scrolling coordinates
With PDFViewCtrl, users can flip pages horizontally or vertically. For scrolling coordinates, the location origin (0, 0) is located at the top left corner of the viewer in page 1. The x axis is positive horizontally to the right and the y axis is positive vertically downward.