PDFium Component Docs

FitMode property

Component: TPdfView  ·  Unit: PDFium
Điều khiển cách trang hiện tại nằm trong vùng khách của trình xem; được áp dụng lại tự động khi Resize và khi PageNumber thay đổi để các tài liệu dài có kích cỡ trang hỗn hợp vẫn được căn khung

Syntax

property FitMode: TPdfFitMode;

Description

FitMode is the standard PDF-viewer fit-page / fit-width selector exposed as a published property so applications can drop a TPdfView onto a form and pick a layout without writing zoom math. Each value maps onto a clear visual behavior:

The active fit mode is re-applied automatically when the control is resized and when the current page changes — that is the whole point of FitMode versus a one-shot zoom assignment. Long documents with mixed page sizes (a portrait cover followed by landscape spreads, for example) stay perfectly framed without any extra Resize / OnPageChange handler.

Setting Zoom directly cancels the active fit mode and reverts FitMode to pfmNone, matching the standard PDF viewer convention where typing a zoom percentage drops out of "Fit Page" / "Fit Width". This keeps the property value honest: FitMode <> pfmNone means "the view will re-fit on the next layout event".

Remarks

Example

// Whole page fits in viewport, even after resize / page change
PdfView1.FitMode := pfmFitPage;

// Page width matches viewport width — long-document reading mode
PdfView1.FitMode := pfmFitWidth;

// 100% — one PDF point per pixel
PdfView1.FitMode := pfmActualSize;

// User types a zoom value → drop out of fit mode
PdfView1.Zoom := 1.5;
Assert(PdfView1.FitMode = pfmNone);

See Also

Zoom, PageZoom, PageWidthZoom, PageHeightZoom, ActualSizeZoom