PDFium Component Docs

DeviceToPage Yöntem

Bu API girdisi tanımlayıcıları, imzaları, kod bloklarını ve PDF terimlerini özgün biçiminde korur.
Bileşen: TPdf  ·  Birim: PDFium
Convert the screen coordinate of a point to page coordinate.

Söz dizimi

function DeviceToPage(X, Y, Left, Top, Width, Height: Integer; Rotation: TRotation; out PageX, PageY: Double): Boolean;

X, YInteger. The device-space coordinates of the point to convert (screen pixels, origin at top-left).
Left, Top, Width, HeightInteger. The rendering rectangle that was passed to the corresponding RenderPage call.
RotationTRotation. İşleme sırasında kullanılan sayfa döndürmesi. Şuna geçirilen değerle eşleşmelidir RenderPage.
PageX, PageYDouble. Output parameters that receive the converted PDF user-space coordinates (origin at lower-left, units in points).

Return Value

Döndürür: True if the conversion succeeded, or False if it failed (for example, if no page is loaded).

Açıklama

Bir noktayı cihaz alanından (ekran pikselleri) PDF kullanıcı alanına (points) dönüştürür. Bu yöntemi, işlenmiş bir sayfadaki fare tıklama konumunu PDF sayfasındaki karşılık gelen konuma çevirmek için kullanın.

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, Üst, Width, Height, and Rotation parameters must match exactly what was passed to the RenderPage call that produced the image being clicked on.

Örnek

// Translate a mouse click on the painted page to PDF coordinates
procedure TForm1.PdfPanelMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  PageX, PageY: Double;
begin
  if Pdf.DeviceToPage(X, Y, 0, 0, PdfPanel.Width, PdfPanel.Height,
    ro0, PageX, PageY) then
    StatusBar1.SimpleText := Format('Page pos: %.1f, %.1f pt', [PageX, PageY]);
end;

Ayrıca bkz.

PageToDevice, RenderPage, PageWidth, PageHeight