PDFium Delphi Component Docs

FPdfMeasure Unità

Unità: FPdfMeasure
Helper di misurazione del testo per TPdf prima che il contenuto venga aggiunto alla pagina

Syntax

TPdfMeasureHelper = class helper for TPdf
  procedure MeasureText(const Text, Font: WString; FontSize: Single; out Width, Height: Double);
  function MeasureTextWidth(const Text, Font: WString; FontSize: Single): Double;
  function WrapText(const Text, Font: WString; FontSize: Single; MaxWidth: Double): TArray<WString>;
  function WrapText(const Text, Font: WString; FontSize: Single; MaxWidth: Double; BreakLongWords: Boolean): TArray<WString>;
end;

Public Methods

MemberDescription
TPdf.MeasureTextRestituisce larghezza e altezza del testo in unità utente PDF per il font e la dimensione selezionati
TPdf.MeasureTextWidthRestituisce solo la larghezza del testo in unità utente PDF
TPdf.WrapTextPreserva gli a-capo espliciti, adatta i token a MaxWidth e può spezzare i token troppo lunghi ai confini di scalare Unicode

Description

FPdfMeasure aggiunge un class helper a TPdf così il testo può essere misurato in unità utente PDF prima del disegno

Usa MeasureText e MeasureTextWidth per i calcoli di layout e WrapText per dividere il testo in righe che si adattano a una larghezza scelta

L'overload WrapText originale mantiene intatto un token sovradimensionato per compatibilità; passa BreakLongWords=True per dividere testo CJK o altro senza spazi preservando le coppie di surrogati UTF-16

Example

var
  Width, Height: Double;
  Lines: TArray<WString>;
begin
  Pdf.MeasureText('Invoice total', 'Arial', 12, Width, Height);
  Lines := Pdf.WrapText(LongText, 'Arial', 10, 240, True);
end;

See Also

TPdf.AddText, TPdf.AddShapedText