Optimize & Repair

Why a PDF refuses to open, and what repair actually does

A PDF that will not open tends to fail in one of a few recognisable ways, and the message rarely says which. That matters, because some damage is cosmetic and some is fatal, and treating the second as the first wastes the file.

What a PDF file is made of

A PDF is a set of objects, plus a table at the end telling a reader where each object begins. That table is the cross-reference table, and it is the part that breaks first.

The reason is in how files get written. The cross-reference table records byte offsets, so it is correct only for the exact bytes that were saved. Anything that moves a byte without updating it invalidates the table: an interrupted download, a disk filling up mid-save, a merge tool that concatenated two files and got the arithmetic slightly wrong, a transfer that converted line endings.

The four kinds of damage

1. Truncated file

The download stopped early, so the end of the file — where the cross-reference table lives — is missing. The pages themselves are often completely intact. This is the most common case and the most recoverable, because a repair tool can walk the objects it finds and rebuild the table from scratch. Expect the last page or two to be missing; expect the rest to open.

2. Mis-offset cross-reference table

The file is all there, but every offset in the table is wrong — often by a few bytes, from a transfer that altered one line ending. Readers give up immediately ("not a PDF, or it is corrupted"). The content is fine. Rebuilding the table fixes it completely.

3. Damaged object inside a page

The table is fine but one image or font object is broken, so the page that uses it fails to render while the rest of the document is healthy. Repair can isolate the broken object, but the page that depended on it will be missing something. This is where a repair tool should say "recovered 47 of 48 pages" rather than claiming a clean fix.

4. Encrypted and locked, not damaged

A file that opens to a password prompt is not broken. It is a different problem with a different tool: unlocking removes protection from a document you have the right to open. Running repair against it will not help, and no repair tool should pretend it will. If you do not know the password, the answer is to ask the sender, not to look for a bypass.

How repair actually works

Good repair tools do not patch the damaged file. They read around the damage and write a new file. Rifinit's Repair tries approaches in increasing order of brutality:

  1. Rebuild the cross-reference table. The right fix for cases 1 and 2: scan the objects, work out where each one truly begins, and write a correct table. This is the approach that preserves everything.
  2. Lenient re-reading. Read the document with a parser that tolerates structural errors instead of refusing, then write a clean copy of what could be read.
  3. A full page walk. Open the document page by page and rebuild it from the pages that load. This salvages content from files whose structure is beyond repair, at the cost of losing structure — bookmarks, form fields and links may not survive.

Each step is only tried if the previous one failed, because a heavier-handed repair on a fixable file loses things it did not need to lose.

What repair cannot get back

  • Bytes that are not there. A truncated download is missing data. Repair retrieves every page that arrived, not pages that never did.
  • A broken image or font object. The page will render, but the image will be blank or the font will be substituted.
  • Encrypted without the password. A different problem, and a different tool.
  • Digital signatures. Repair rewrites the file, and any signature over the original bytes is invalidated by that. If a signed document must remain signed, do not repair it — preserve the original bytes and obtain a clean copy.

Before you repair, do this

  1. Keep the original. Work on a copy. Repair is not the moment to discover that the only copy was overwritten.
  2. Check the download completed. The single most common cause is an interrupted transfer; re-downloading often solves it with no repair needed.
  3. Try another viewer. If one application refuses and another opens it, the file is usually valid and the first reader is strict. That changes the problem from damaged to incompatible.
  4. Repair, then verify page count. Compare the recovered page count against what you expected. That number tells you whether you have everything.

The useful habit: a PDF that will not open is a question about which part broke, not a verdict on the file. Most of the time the answer is the cross-reference table, and most of the time it is rebuildable.

Alex Roshid — Editorial lead, Rifinit. More about the author · How we write and review.

Open Repair PDF Read the full guide Browse all tools

Standards and sources: PDF parsing and writing follow the open PDF specification, documented in the Library of Congress format registry; the interface follows WCAG 2.2 (W3C). Rifinit is independent of both organisations.

By the Rifinit team. Published under the Alex Roshid byline. We build, test and document these PDF tools in-house: every guide is written by the same engineers who work on the converters, the editor and the OCR pipeline. Meet the team. Read how we write and review, our privacy policy and terms. Last reviewed .

Follow Rifinit Facebook LinkedIn Pinterest Reddit