sn-plugin-lib later than 0.1.65, the coordinates a plugin reads from and writes to the SDK use a single system: Android pixel coordinates, based on the actual page size.
sn-plugin-lib 0.1.65 and earlier return EMR (electromagnetic digitizer) coordinates. Later versions return Android pixel coordinates only. The host decides which one to return based on the sn-plugin-lib version the plugin uses, not on the device system version.Android Coordinate System
Definition- The unit is pixels (px).
- Conventionally, top-left is the origin:
xincreases to the right,yincreases downward. width/heightrepresent the pixel dimensions of the page (e.g., A5X often uses1404×1872, Manta often uses1920×2560).
- Stroke sample points (
pointsinStroke) and five-star points - The lasso rectangle and lasso element points. See Lasso
- Positions and regions of geometry, links, titles, text boxes, and similar elements
Use the Actual Page Size
Every coordinate you pass to the SDK, and every coordinate you get back, is based on the actual page size. Get that size withPluginFileAPI.getPageSize, which returns { width, height }. Coordinates should fall within 0..width and 0..height, regardless of the size shown on screen.
When you operate on the current page, the actual page size from
getPageSize is still the baseline. Use getCurrentFilePath and getCurrentPageNum to get the current file path and page number, then call getPageSize.EMR Coordinate System (Older Versions)
EMR coordinates are used only in
sn-plugin-lib 0.1.65 and earlier. Converting between EMR and Android coordinates is tedious, so later versions no longer let plugins read or write EMR coordinates. The SDK APIs perform all conversions internally. Plugins pass in and get back Android pixel coordinates only, and do not need to convert anything themselves. This section is kept so you know what EMR is when you read older plugins or older docs.- The unit is not pixels, but the digitizer’s hardware coordinate unit (you can think of it as a finer grid).
- It is typically higher precision: one screen pixel may correspond to multiple EMR units.
- Axes and origin may differ from screen coordinates (varies by device and orientation), so conversion is required.
- Not equivalent to UI pixels: you cannot use EMR values as px for layout directly.
In older versions, use
PointUtils to convert between EMR and pixel coordinates.
Compatibility APIs for Older Versions
The following APIs are kept only for plugins that usesn-plugin-lib 0.1.65 or earlier. With later versions, avoid using them:
androidPoint2Emr/emrPoint2AndroidinPointUtils: convert between EMR and pixel coordinatesgetPageDisplaySize: get the display size of the current pagemaxX/maxYonElement: maximum values in EMR units