Docs PDFiumVCL

Constraints property

Esta entrada API preserva identificadores, assinaturas, blocos de código e termos PDF em sua forma original.
Component: TPdfView  ·  Unit: PDFium
Defines the minimum and maximum width and height the PDF viewer is allowed to reach when its parent is resized.

Syntax

property Constraints: TSizeConstraints; // published, inherited from TControl

Description

Constraints exposes the four sub-properties MinWidth, MaxWidth, MinHeight and MaxHeight (all default 0 = no limit). They clamp the resize logic driven by Align, Anchors, or explicit SetBounds calls, preventing the viewer from collapsing below a usable minimum or growing beyond a sensible maximum.

For PDF reader applications the minimum dimensions matter most: rendering becomes uncomfortable below roughly 240 x 180, and the scroll bars start to fight for space with the page itself. Setting MinWidth := 320 and MinHeight := 240 avoids that visual breakdown while still letting users dock the viewer narrowly.

When a constraint kicks in, the active FitMode recalculates the page zoom against the clamped client size. This guarantees that fit-to-width and fit-to-page never produce zero or negative pixel sizes that would otherwise cause PDFium to skip rendering.

Remarks

Example

// Keep the viewer usable in any layout configuration
procedure TForm1.FormCreate(Sender: TObject);
begin
  PdfView1.Constraints.MinWidth := 320;
  PdfView1.Constraints.MinHeight := 240;
  PdfView1.Constraints.MaxWidth := 0; // no max
  PdfView1.Constraints.MaxHeight := 0; // no max
  PdfView1.Anchors := [akLeft, akTop, akRight, akBottom];
  PdfView1.FitMode := pfmFitToWidth;
end;

See Also

Align, Anchors, OnResize, FitMode