PDFium Delphi Component Docs

NormalizePageViewRect function

Unit: PDFium
Normalizes two mapped page-space corners into the visible rectangle of a page, clamped to its bounds

Syntax

function NormalizePageViewRect(X1, Y1, X2, Y2, PageWidth, PageHeight: Double; out Left, Top, Right, Bottom: Double): Boolean;

Parameters

X1, Y1, X2, Y2Double
PageWidth, PageHeightDouble
Left, Top, Right, BottomDouble

Return Value

Boolean

Description

Page space counts Y upwards while device space counts it down, so two mapped corners arrive in either order; the smaller values become Left and Top

The rectangle is clamped to the page bounds, so an oversized viewport reports the page itself rather than the viewport

Returns False when the page has no size or the clamped rectangle is empty, which is how a page scrolled entirely out of view is reported

Split out of the FFI_GetPageViewRect form-fill callback so the geometry is testable without a cdecl callback round trip

See Also

TPdfView.DeviceToPage, TPdfView.PageToDevice