> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/android/viewer/coordinates.md).

# Understanding PDF coordinates

Understand PDFViewCtrl location coordinates in Android. Learn about PDF page, screen, and scrolling coordinates. See how annotations change with zoom. Click for detailed insights! The Apryse Android S

When dealing with locations in `PDFViewCtrl` it is important to understand what coordinate space they are located in. For example when you get (x, y) value from [`MotionEvent`](https://developer.android.com/reference/android/view/MotionEvent/), the location is relative to the screen, not PDF page.

PDF document has its own coordinate system, which differs from Android's view coordinate system. When you ask for the position of an annotation in a PDF document using the Apryse API, the position is given in [PDF page coordinates](https://docs.apryse.com) instead of [Android screen coordinates](https://docs.apryse.com). To illustrate this, here is a screen capture of an annotation and a table of its coordinates as PDF page coordinates, screen coordinates, and [scrolling coordinates](https://docs.apryse.com):

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-eb101ff5a19abccb8f2ec1b84d3091fb83f09670%2Fbe1cdfd0531cae154c11f97a8ef95e825bc05a39-1080x1802.png?alt=media)

| Coordinates           | x1     | y1     | x2     | y2    |
| --------------------- | ------ | ------ | ------ | ----- |
| PDF page coordinates  | 62.8   | 165.3  | 538.4  | 415.5 |
| Screen coordinates    | 62.0   | 1368.6 | 1023.9 | 862.5 |
| Scrolling coordinates | 5063.0 | 1368.6 | 6024.9 | 862.5 |

## PDF page coordinates

In a PDF document, the location (0, 0) is at the bottom left corner of the **PDF page**. The x axis extends horizontally to the right and y axis extends vertically upward. A **page point** represents a point in page coordinates.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-17153f420dabe329690dd2525e82123c03b66628%2Fa38dae8c03f489fb935957f87d8be0b60417e3d1-328x559.jpg?alt=media)

A PDF page may have a rotation associated with it. In this case, the coordinate (0, 0) may no longer correspond to the bottom left corner of the page.

For example, here is the same page shown as above, but rotated 90 degrees clockwise. Notice how the coordinate (0, 0) is now at the top left corner of the viewport.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-79e19fd4925192614b0f98fe3590b5d7fc6d3994%2Fd42dc93a1ffa17361521f159200ec1e2389b2d45-415x322.jpg?alt=media)

## Screen coordinates

In Android views and in the `PDFViewCtrl` class, the locations of a view are measured in screen coordinates. Point (0, 0) is at the top left corner of the **view**. The x axis extends horizontally to the right and the y axis extends vertically downward. A **screen point** represents a point in screen coordinates.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-8f10c3f67d059c32bcc8874be5b96cffc6fe0b59%2F5c877389a279c2e5ca342c714719bafe0d498d35-324x560.jpg?alt=media)

Since screen coordinates measure Android views, if `PDFViewCtrl` zooms in, the annotation's screen coordinates may change.

For example, here are two screen captures of the same annotation before and after zooming in, and a table showing how its screen coordinates change:

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-a81a8bbf062497182b3949c0fc679e947a3d95fd%2F6f87bb820e5fa93c7a1779fd8b75743c400b6bf1-2300x2020.png?alt=media)

|                | 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

In `PDFViewCtrl`, users can flip pages horizontally or vertically. In scrolling coordinates, the point (0, 0) is located at the top left corner of the **view** in **page 1**. The x axis extends horizontally to the right and the y axis extends vertically downward.

![](https://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%2Fuploads%2Fgit-blob-e7f5c01ea2607a9432b9755e959bafe48650df0e%2Fccfc341e1eb06df9b0830b1e10b0cc8296e75881-1024x715.png?alt=media)

## Convert between different coordinates

`PDFViewCtrl` allows you to convert from one coordinate system to another with ease:

| Method                                                                                                                                                                                                       | Description                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------- |
| \[`convPagePtToHorizontalScrollingPt(double, double, int)`]\(<https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.html#convPagePtToHorizontalScrollingPt(double>, double, int)) | Converts a point from page space to scrolling space. |
| \[`convPagePtToScreenPt(double, double, int)`]\(<https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.html#convPagePtToScreenPt(double>, double, int))                           | Converts a point from page space to screen space.    |
| \[`convScreenPtToPagePt(double, double, int)`]\(<https://sdk.apryse.com/api/android/javadoc/reference/com/pdftron/pdf/PDFViewCtrl.html#convScreenPtToPagePt(double>, double, int))                           | Converts a point from screen space to page space.    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/android/viewer/coordinates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
