PDFium Delphi Component Docs

Utilidades acotadas para comparar PDF

FPdfDiff implementa la alineación de páginas, los cambios de texto UTF-16 y las regiones visuales conexas utilizados por CompareWith

AlignPdfDiffPages empareja huellas exactas de texto, geometría e imagen mediante una subsecuencia común más larga limitada; después identifica como movimientos las coincidencias exactas restantes y empareja los huecos como modificaciones

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

BuildPdfDiffTextChanges informa de desplazamientos y longitudes UTF-16 con base cero; el modo de caracteres mantiene unidos los surrogate pairs y el modo de palabras agrupa los espacios en blanco aparte del resto de caracteres

BuildPdfDiffPixelRegions agrupa tiles modificados conexos en rectángulos de píxeles con bordes derecho e inferior exclusivos; pueden incluir píxeles sin cambios dentro de un tile

La alineación admite como máximo 4,096 páginas por documento y 16,777,216 celdas; el texto admite 65,536 tokens y 16,777,216 unidades UTF-16, e indica explícitamente el truncamiento al agotar 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;