PDFium Component Docs

PageToDevice 메서드

이 API 항목은 식별자, 시그니처, 코드 블록, PDF 용어를 원래 형태로 유지합니다.
컴포넌트: TPdf  ·  유닛: PDFium
point의 page coordinate를 screen coordinate로 변환합니다

구문

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

PageX, PageYDouble. 변환할 PDF user-space coordinates입니다(원점은 왼쪽 아래, 단위는 points)
Left, Top, Width, HeightInteger. 해당 RenderPage call에 전달된 rendering rectangle입니다
RotationTRotation. 렌더링할 때 사용한 page rotation입니다. RenderPage에 전달한 값과 같아야 합니다
X, YInteger. 변환된 device-space pixel coordinates를 받는 output parameter입니다(원점은 왼쪽 위)

Return Value

변환이 성공하면 True, 실패하면 False를 반환합니다(예: page가 로드되지 않은 경우)

설명

point를 PDF user space(points)에서 device space(screen pixels)로 변환합니다. 이 method를 사용하면 알고 있는 PDF-coordinate 위치가 렌더된 image의 어디에 놓이는지 알 수 있습니다 — 예를 들어 annotation overlay나 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, 맨 위, 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.Color := clRed;
    Canvas.Ellipse(ScreenX - 4, ScreenY - 4, ScreenX + 4, ScreenY + 4);
  end;
end;

참고 항목

DeviceToPage, RenderPage, PageWidth, PageHeight