See what changed. Know what matters.
PDiffy detects meaningful changes in content, structure, layout and accessibility, without the noise of binary differences. It says what changed, element by element, and for a PDF, on the page where it happened.
[Fact]
public async Task TrailGuide_ShouldMatchApprovedSnapshot_WhenGenerated()
{
using Stream pdf = await ReportGenerator.CreateTrailGuideAsync();
await Snapshot.VerifyPdfAsync(pdf);
}
3 change(s): 1 moved, 1 attribute, 1 text
by section: structure 3
2 can affect accessibility, listed first
↕ moved structure > Document > Figure (p1) [accessibility]
reading position 3 -> 10
~ attribute structure > Document > Table > TR[1] > TH2 (p2) [accessibility]
scope: Column -> (missing)
~ text structure > Document > Table > TR[2] > TD[2] (p2)
"Go with without a guide"
Inspect, compare and test
PDiffy reads a document once, then gives you a typed model to inspect, a comparison with any other version, and snapshots you review in pull requests.
Inspect
Assert on alt text, forms, fonts and settings through typed properties, or run the built-in accessibility checks.
Compare
Compare two documents, or a PDF with its remediated version, from a test or the command line, and two folders from the command line. None of them needs snapshot files.
Test
Compare a PDF, Word document, text or JSON with its approved snapshot, and approve a change with one command.
Accessibility first
Lost alt text, a changed reading order or new untagged content is flagged and listed before everything else.
Choose what a test guards
Profiles, ignored sections and details, tolerances and scrubbers, all as enums. No PDF knowledge needed.
Word documents too
Styles, lists, tables, tracked changes and fields, read straight from the file with no Office or SDK.
Upgrade without breaking your documents
A new version of the library that writes your PDFs can drop a font's Unicode map, retag a heading as a paragraph
or strip the tags, while every page looks the same. A snapshot test catches it the first time the upgrade runs, and
pdiffy compare checks a whole folder of documents before and after.
$ dotnet pdiffy before.pdf after.pdf
2 change(s): 1 attribute, 1 changed
by section: structure 1, fonts 1
2 can affect accessibility, listed first
~ changed structure > Document > P[1] (p1) [accessibility]
type: H1 -> P
~ attribute fonts > Helvetica [accessibility]
to-unicode: yes -> no
A report you can open from CI
Every failure also writes one HTML file: both snapshots side by side, the changed words highlighted, accessibility changes first and a map of what moved on each page.
See a sample report
The report for the trail guide above, as a test writes it.
Continuous integration
Keep the received files and reports as build artifacts, and fail fast on a missing snapshot.
The pdiffy tool
Accept snapshots, compare folders, check documents and find unused snapshots from the command line.
Find your way
The documentation is grouped by what you're trying to do.
Install
Both packages target .NET 10 and are fully managed, so a snapshot made on Windows matches one made on Linux. They work with any test framework.
PDiffy.Cli
The pdiffy command-line tool, installed as a local tool at the same version as the PDiffy package.
dotnet new tool-manifest
dotnet tool install PDiffy.Cli --version <version>