PDFium Delphi Component Docs

Helper per il confronto PDF con limiti di risorse

FPdfDiff implementa l'allineamento delle pagine, le modifiche al testo UTF-16 e le regioni visive connesse usate da CompareWith

AlignPdfDiffPages abbina impronte identiche di testo, geometria e contenuto visivo tramite una sottosequenza comune più lunga con limiti di risorse, poi identifica le altre corrispondenze esatte come spostamenti e abbina gli intervalli non corrispondenti come modifiche

Le pagine duplicate vengono abbinate in modo deterministico; una pagina spostata e modificata nello stesso momento non è necessariamente riconosciuta come spostamento

BuildPdfDiffTextChanges segnala offset e lunghezze UTF-16 a base zero; la modalità carattere mantiene unite le coppie surrogate e la modalità parola raggruppa gli spazi separatamente dagli altri caratteri

BuildPdfDiffPixelRegions raggruppa i tile modificati connessi in rettangoli di pixel con bordo destro e inferiore esclusi; una regione può includere pixel invariati all'interno di un tile

L'allineamento accetta al massimo 4,096 pagine per lato e 16,777,216 celle; il testo accetta al massimo 65,536 token e 16,777,216 unità UTF-16, con troncamento esplicito quando si esauriscono i limiti di dettaglio selezionati

Dichiarazioni pubbliche

type
  TPdfDiffPageKind= (dpkMatched, dpkModified, dpkMoved, dpkInserted, dpkDeleted);
  TPdfDiffTextMode= (dtmNone, dtmCharacters, dtmWords);
  TPdfDiffPageSignature= record
    Text: WideString;
    VisualHash: UInt64;
    Width, Height: Single;
    Rotation: Integer;
  end;
  TPdfDiffPageSignatures= array of TPdfDiffPageSignature;
  TPdfDiffPagePair= record
    LeftPageIndex, RightPageIndex: Integer;
    Kind: TPdfDiffPageKind;
  end;
  TPdfDiffPagePairs= array of TPdfDiffPagePair;
  // Offsets and lengths count UTF-16 code units, starting at zero
  TPdfDiffTextChange= record
    LeftStart, LeftLength, RightStart, RightLength: Integer;
  end;
  TPdfDiffTextChanges= array of TPdfDiffTextChange;
  TPdfDiffPixelRegion= record
    Left, Top, Right, Bottom: Integer;
  end;
  TPdfDiffPixelRegions= array of TPdfDiffPixelRegion;

function AlignPdfDiffPages(const Left, Right: TPdfDiffPageSignatures;
  MaxCells: Integer): TPdfDiffPagePairs;
function BuildPdfDiffTextChanges(const Left, Right: WideString;
  Mode: TPdfDiffTextMode; MaxCells, MaxTokens: Integer;
  out Truncated: Boolean): TPdfDiffTextChanges;
function BuildPdfDiffPixelRegions(const Mask: TBytes; Width, Height,
  TileSize, MaxRegions: Integer; out Truncated: Boolean): TPdfDiffPixelRegions;