PDF comparison is useful for regression baselines, generated reports, invoices, and publishing pipelines where a successful file write is not enough. The comparison report keeps structural findings beside rendered evidence so a changed page count is not reduced to a pixel score.
Compare from .NET
using OfficeIMO.Pdf;
byte[] expected = File.ReadAllBytes("approved.pdf");
byte[] actual = File.ReadAllBytes("candidate.pdf");
PdfVisualComparisonReport report = PdfVisualComparer.Compare(expected, actual);
File.WriteAllText("comparison.html", report.ToHtmlGallery("Release comparison"));
Console.WriteLine($"Match: {report.IsMatch}");
Application code can configure page selection, channel tolerance, allowed difference ratio, and resource budgets. The browser route deliberately uses exact comparison thresholds and fixed limits so an unexpectedly large document cannot consume unbounded memory.
Read the evidence correctly
A visual match means the compared pages satisfied the selected rendering threshold. It does not prove semantic equality, identical metadata, equivalent signatures, or byte-for-byte identity. Conversely, a visual difference may be a legitimate font, rendering, or pagination change. Review the gallery and structural findings before accepting or rejecting the candidate.