Docs de PDFiumPas

Constraints Propiedad

Esta entrada API conserva identificadores, firmas, bloques de código y términos PDF en su forma original.
Componente: TPdfView  ·  Unidad: PDFium
Define el ancho y el alto mínimos y máximos que el visor de PDF puede alcanzar cuando se redimensiona su contenedor padre

Sintaxis

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

Descripción

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.

En las aplicaciones lectoras de PDF, las dimensiones mínimas son las que más importan: el renderizado se vuelve incómodo por debajo de aproximadamente 240 x 180, y las barras de desplazamiento empiezan a pelear por el espacio con la propia página. Establecer 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 recalcula el zoom de la página frente al tamaño de cliente limitado. Esto garantiza que fit-to-width y fit-to-page no produzcan nunca tamaños de píxel cero o negativos que de otro modo harían que PDFium omitiera el renderizado

Notas

Ejemplo

// 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;

Véase también

Align, Anchors, OnResize, FitMode