THPDFDocComparison.CompareWithOptions
Runs structural, page, or perceptual rendered comparison with caller-selected resource limits and render thresholds
Declaration
class function CompareWithOptions(DocA, DocB: THotPDF;
Mode: THPDFComparisonMode;
const Limits: THPDFStructuralCompareLimits;
const RenderOptions: THPDFRenderedCompareOptions): AnsiString;
Parameters
DocAandDocBare loaded documentsModeselects the comparison surfacesLimitsbounds structural traversal, page count, and retained differencesRenderOptionsselects DPI, color metrics, thresholds, regions, overlays, and pixel budgets
Result
Returns deterministic JSON with normalized options, aggregate completeness, differences, and per-page rendered metrics when rendering is selected
Rendering and overlay errors fail closed as reported differences and make the comparison incomplete
Example
Limits := THPDFStructuralCompareLimits.Default;
RenderOptions := THPDFRenderedCompareOptions.Default;
RenderOptions.DPI := 144;
RenderOptions.ColorTolerance := 3;
RenderOptions.MinimumSimilarity := 0.995;
RenderOptions.MaxChangedPixelRatio := 0.001;
RenderOptions.GenerateHeatmaps := True;
RenderOptions.HeatmapDirectory := 'comparison-output';
Report := THPDFDocComparison.CompareWithOptions(
BeforeDocument, AfterDocument, cmFull, Limits, RenderOptions);
See also
THPDFRenderedCompareOptions · THPDFStructuralCompareLimits · Document Comparison