Comparing two versions of a contract when one is a .docx and the other a PDF
The usual advice for "which line changed?" assumes both versions are plain text. In practice the first draft arrives as a Word file and the countersigned copy comes back as a PDF, and the two never diff cleanly unless you normalise them first. This is the checklist I use before I trust any diff.
1. Extract, don't screenshot
Paste only extracted text into the comparison. A PDF exported from Word keeps the text layer, so copying it out works; a scanned PDF has no text layer at all and every line will show as changed. Run the Ctrl+F test on the PDF first: if it cannot find a word you can see, you need OCR before a diff, not a diff.
2. Kill the differences that are not differences
- Line breaks. A PDF breaks every visual line; a .docx breaks only paragraphs. Diff by word or by sentence, never by line, or the whole document lights up.
- Curly quotes and dashes. Word autocorrects
"to“ ”and--to—. Fold them before comparing. - Non-breaking spaces. Word inserts
U+00A0after numbers and before units; they look identical to a space and count as a change. - Hyphenation at line ends. "agree-" + "ment" in the PDF is one word in the .docx.
3. Arabic needs one more step
Arabic text extracted from a PDF can come out in visual order (right-to-left already applied) instead of logical order, and some extractors return presentation-form code points for the shaped letters. Normalise to NFKC and confirm the letters are joined before diffing; otherwise every Arabic sentence reads as rewritten. I wrote up the mechanism in why Arabic text reverses when a PDF is converted to Word.
4. Read the diff as a lawyer, not as a programmer
Once the noise is gone, what remains is short: a changed number, a swapped party name, a deleted clause. Read additions and deletions as pairs and check the numbers twice, since "30 days" to "3 days" is a one-character change that carries the whole risk.
The tool I use
I built the normalisation above into the diff at Confileo so the steps happen automatically: it reads .docx and PDF directly, folds quotes, spaces and line breaks, handles Arabic order, and shows word-level changes side by side. Use it to compare two texts online; uploaded files are deleted automatically once the text has been extracted.
بالعربية
قائمة فحص قصيرة لمقارنة نسختين من عقد عندما تأتي إحداهما ملف Word والأخرى PDF: استخرج النص بدل تصوير الشاشة، وحّد علامات الاقتباس والشرطات والمسافات غير الفاصلة، قارن بالكلمة لا بالسطر، وطبّع النص العربي إلى NFKC حتى لا تظهر كل جملة عربية على أنها أُعيدت كتابتها. أداة مقارنة النصوص في كونفيليو تقرأ ملفات Word وPDF مباشرة وتطبّق هذه الخطوات تلقائياً.