FPDF_DeviceToPage method
Function: FPDF_DeviceToPage Convert the screen coordinates of a point to page coordinates. Parameters: page - Handle to the page. Returned by FPDF_LoadPage. start_x - Left pixel position of the display area in device coordinates. start_y - Top pixel position of the display area in device coordinates. size_x - Horizontal size (in pixels) for displaying the page. size_y - Vertical size (in pixels) for displaying the page. rotate - Page orientation: 0 (normal) 1 (rotated 90 degrees clockwise) 2 (rotated 180 degrees) 3 (rotated 90 degrees counter-clockwise) device_x - X value in device coordinates to be converted. device_y - Y value in device coordinates to be converted. page_x - A pointer to a double receiving the converted X value in page coordinates. page_y - A pointer to a double receiving the converted Y value in page coordinates. Return value: Returns true if the conversion succeeds, and |page_x| and |page_y| successfully receives the converted coordinates. Comments: The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up.
NOTE: this coordinate system can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have the same coordinate values in the page coordinate system.
The device coordinate system is device dependent. For screen device, its origin is at the left-top corner of the window. However this origin can be altered by the Windows coordinate transformation utilities.
You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly same values as you used in the FPDF_RenderPage() function call.
Implementation
int FPDF_DeviceToPage(
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int device_x,
int device_y,
ffi.Pointer<ffi.Double> page_x,
ffi.Pointer<ffi.Double> page_y,
) {
return _FPDF_DeviceToPage(
page,
start_x,
start_y,
size_x,
size_y,
rotate,
device_x,
device_y,
page_x,
page_y,
);
}