When a PDF will not open
A file that refuses to open is alarming in a way few document problems are, particularly when it is the only copy. It is worth knowing that the commonest kind of PDF damage is no longer damage at all, that the kind which still matters looks quite different, and that a file which will not open is not necessarily a file with nothing left in it.
The classic broken PDF is not broken any more
Every PDF carries an index — a table saying where in the file each object lives. When that table is wrong, older software refused to open the document at all, and this is the damage that made 'corrupt PDF' a common phrase.
Modern readers do not rely on it. When the index disagrees with the file, they scan the file for the objects themselves and rebuild it silently. Your browser does this. So does almost every current viewer. A file whose only problem is a broken index therefore opens perfectly well, and nothing needs repairing.
This explains a confusing situation people often land in: one program refuses a document while another shows it without complaint. The refusing program is usually the stricter one rather than the correct one. If a specific application is rejecting a file that opens elsewhere, rewriting the document through any tool that re-saves it will frequently produce something that application accepts.
The damage that still matters is missing content
The files that genuinely will not open anywhere are usually the ones that are not all there. A download that stopped part way, a transfer interrupted, a copy taken off a failing disk or a memory card that was removed too early.
These have a distinctive signature. The document's own page tree still says how many pages it should have, and fewer than that are actually present in the file. Careful software notices the disagreement and refuses, which is the right behaviour almost everywhere: quietly handing back twenty-three pages of a document somebody believes has twenty-four is how content goes missing without anyone finding out.
The useful consequence is that those twenty-three pages are usually intact. Recovery cannot invent the bytes that never arrived, but it can take what is present and rebuild it into a document that is honest about its own length — and therefore opens.
Why some files recover almost everything and others nothing
Two documents damaged in exactly the same way can behave completely differently, and the reason is a choice made when they were written.
Many programs pack a document's objects into a handful of compressed blocks. This is excellent for file size and unforgiving under damage: losing any part of a compressed block destroys everything inside it, so there is no partial structure left to walk. A document written that way tends to go straight from working to unrecoverable.
A document written with plain, separate objects degrades gracefully instead — page by page, in proportion to how much of the file survived. Nothing about the two looks different from the outside, which is why recovery results vary so widely between files that appear equally broken.
Before you try anything
Keep the original. Every recovery produces a new file, and the damaged one is the only evidence of what was there; a second attempt with a different approach needs it.
Check the file size against where it came from if you can. A download that is a fraction of the expected size is not corrupt in any interesting sense — it is incomplete, and fetching it again is a far better answer than any repair.
Finally, read the result before relying on it. A recovered document that opens is not proof that nothing was lost, and a tool that tells you how many pages it could not recover is being more useful than one that simply hands back a shorter file.