Repository navigation
v0.37.0
Say what changed between two versions of a document
ops.Compare and pdfops compare.
pdfops compare draft1.pdf draft2.pdf- -> 2 page added
2 -> 3 text removed zeta
2 -> 3 text added theta
2 of 3 page(s) changed
⛔ The pages are paired by what they say, not by their numbers. A page
inserted in the middle moves nothing after it: the pages that follow are still
paired with the pages they came from, and the insertion is one page added.
A pair must share half its words, or it is one page removed and another
added — without that floor a replaced chapter reads as a rewrite of the one
before it.
Inside a pair the diff is Myers (An O(ND) Difference Algorithm and Its
Variations, Algorithmica 1 (1986) 251–266) over words, with the words that
changed together reported together: "quick brown fox" → "slow grey mole" is
two changes, not six. Pictures are told apart by a hash of their samples, so
a swapped logo of the same size is a change; annotations by their subtype and
their text.
Bounded on both axes, because the input is two files and a file can say
anything: the alignment gives up past four million page pairs and pairs the
pages where they stand, and the diff gives up past two thousand differences and
reports both pages whole. A reference that points at itself stops the
comparison with the page named.
⛔ compare exits 0 whether or not the documents differ, unlike diff: in
this command an exit of 1 means the work could not be done, and a document that
changed is the work being done. The answer is in the last line, in words.
Closes the Compare PDFs row of the BentoPDF gap table for everything a
library can answer; side by side and overlay are the workbench's.
🤖 Generated with Claude Code