PDFium Delphi Component Docs

Helpers de comparación de PDF con límites definidos

FPdfDiff implementa la alineación de páginas, los cambios de texto UTF-16 y las regiones visuales conectadas que usa CompareWith

AlignPdfDiffPages empareja huellas idénticas de texto, geometría y contenido visual mediante una subsecuencia común más larga con límites definidos; después identifica las coincidencias exactas restantes como movimientos y empareja los huecos sin correspondencia como modificaciones

Las páginas duplicadas se emparejan de forma determinista; no se garantiza que una página que cambie y se mueva a la vez se identifique como movimiento

BuildPdfDiffTextChanges informa offsets y longitudes UTF-16 con base cero; el modo por carácter mantiene juntos los pares sustitutos y el modo por palabra agrupa los espacios en blanco por separado de los demás caracteres

BuildPdfDiffPixelRegions agrupa los mosaicos modificados conectados en rectángulos de píxeles cuyos límites derecho e inferior son exclusivos; estas regiones pueden incluir píxeles sin cambios dentro de un mosaico

La alineación acepta hasta 4,096 páginas por lado y 16,777,216 celdas; el texto acepta hasta 65,536 tokens y 16,777,216 unidades UTF-16, y señala explícitamente el truncamiento cuando se agotan los límites de detalle seleccionados

Declaraciones públicas

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;