You open a PDF in Word, accept the conversion warning and get something that looks like the original… until page two. The columns have merged into one, the table spans two pages and the footer sits in the middle of the text. To build a better converter I first needed an honest way to say how much better it is.
Why it's hard
A PDF and a Word file store documents in opposite ways:
- A PDF is a drawing. It stores every letter at its exact position on the page. It has no idea what a paragraph, a column or a table is: there are only pieces of text placed at coordinates.
- A Word file is a description. It stores paragraphs, styles, tables and sections, and Word decides where each line falls when it opens the file.
Converting one into the other means guessing the structure (this block is a justified paragraph, these are two columns, this is a four-row table) so that when Word lays it out again, every word ends up where it was. If the structure is even slightly off, the error carries forward: a line that breaks in a different place pushes every line after it.
The metric: words in place
"Looks fine" is deceptive: the eye forgives a lot on one page and nothing on the next. So the measurement is automatic and always the same:
- We convert the PDF to DOCX.
- We open the DOCX in Word (and in LibreOffice) and save it as a PDF again. That way we measure what the reader will see, not what we think we wrote.
- We extract the words from both PDFs, the original and the new one, with their positions.
- We pair the words by their text and order, page by page.
- For each pair we measure how far it moved: horizontally, the word's left edge; vertically, the baseline, because the bottom of the box depends on each font.
The score is the percentage of the original's words that appear on the same page and within 3 points of their place. Three points is just over a millimetre: less than the gap between two lines, so a line that jumps to the next one counts as a miss, but an invisible shift doesn't.
Measuring on documents it hasn't seen
It's easy to fool yourself: if you tune a converter while always looking at the same documents, it ends up working wonderfully on those and so-so on the rest. To avoid that, the documents are split into groups:
- Diagnostic: the ones I do look at, page by page, to find bugs.
- Held-out: 73 real PDFs where I only look at the overall score. If a change lowers it, the change is dropped, even if it improves the diagnostic set.
- Sealed: 148 new real PDFs that had never been used, to check now and then that what was learned holds for unknown documents.
And one rule that's hard to keep: general fixes, not patches for a specific document. A patch raises the diagnostic score and doesn't show on the held-out set; a general fix raises both.
Results
With this method, on the 73 real held-out PDFs and opening the result in Word:
| Converter | Words within 3 pt | |
|---|---|---|
| Word opening the PDF | 1.4% | |
| pdf2docx (open-source library) | 25.4% | |
| Clic'n Done PDF | 94.7% |
On the 148 sealed PDFs, which the converter had never seen, it scores 95.4%. The two numbers being so close is the best sign that we're not measuring a mirage.
We also tried Docling, an open-source AI that's very good at extracting a document's structure: it recovers the text well (around 94% on Word documents), but places 0% of the words within 3 points. That's not a flaw: it's designed so that another AI can read the document, not to reproduce how it looks. And it's why our converter relies on geometry and measured rules rather than a large model.
What still breaks
The metric also tells us where we're weakest, and that's worth saying:
- Scans: with OCR the text comes out editable and in place, but the layout is poorer than for a PDF with real text.
- Complex formulas and very dense tables are the weakest spots.
- Fonts: if the PDF uses an Office font with no free substitute, the result scores lower on the server, which runs Linux.
The takeaway
The metric isn't perfect: a document can have every word in place and still miss a table rule. But it gives a reliable number you can follow change by change, and it forces you to be honest. Almost every improvement to the converter came out of the same loop: measure, look at the worst documents, find the general fix and measure again on the unseen ones.
If you'd like to see the result on your own documents, you can try the converter: it's free and files delete themselves within an hour.
Comments or ideas? Message me on LinkedIn. LinkedIn →