function PageToDevice(PageX, PageY: Double; Left, Top, Width, Height: Integer; Rotation: TRotation; out X, Y: Integer): Boolean;
| PageX, PageY | Double. The PDF user-space coordinates to convert (origin at lower-left, units in points). |
| Left, Top, Width, Height | Integer. The rendering rectangle that was passed to the corresponding RenderPage call. |
| Rotation | TRotation. The page rotation used when rendering. Must match the value passed to RenderPage. |
| X, Y | Integer. Output parameters that receive the converted device-space pixel coordinates (origin at top-left). |
True if the conversion succeeded, or False if it failed (for example, if no page is loaded).Converts a point from PDF user space (points) to device space (screen pixels). Use this method to determine where a known PDF-coordinate position falls on the rendered image — for example, to position an annotation overlay or highlight rectangle.
PDF user space has its origin at the lower-left corner of the page, with the Y axis pointing upward. Device space has its origin at the top-left corner of the render rectangle, with the Y axis pointing downward.
The Left, Top, Width, Height, and Rotation parameters must match exactly what was passed to the RenderPage call that produced the image being mapped onto.
// Draw a marker on screen at a known PDF position
var
ScreenX, ScreenY: Integer;
begin
if Pdf.PageToDevice(100.0, 200.0, 0, 0,
PdfPanel.Width, PdfPanel.Height, ro0, ScreenX, ScreenY) then
begin
Canvas.Pen.Colour := clRed;
Canvas.Ellipse(ScreenX - 4, ScreenY - 4, ScreenX + 4, ScreenY + 4);
end;
end;