PDF5 min

How to Repair a Corrupted or "Damaged" PDF File

Rebuild a broken PDF's xref table, recover pages from a truncated download, and salvage what you can — all in the browser.

Repair runs locally via Zro7 Repair PDF. Your (possibly sensitive) broken file stays in your browser.

To repair a corrupted or "damaged" PDF, use Zro7 Repair PDF. It scans the file byte-by-byte, rebuilds the cross-reference (xref) table from surviving objects, and writes a fresh PDF containing every page it can recover. All in your browser, so a confidential broken file doesn't have to be sent anywhere.

Why PDFs "break"

  • Truncated download / upload — the last few KB (including the xref table and %%EOF marker) never arrived.
  • Wrong FTP mode — ASCII mode mangles binary bytes (\r\n vs \n).
  • Editor crash mid-save — trailer written before all objects flushed.
  • Concatenated files — two PDFs glued together with cat a.pdf b.pdf (viewers only read the first one).
  • Partial encryption — a broken lock/unlock left inconsistent state.

How Repair PDF works

  1. Scan the raw bytes for every valid obj ... endobj block, ignoring the broken xref.
  2. Build a fresh xref pointing at the surviving objects.
  3. Locate the root Catalog and page tree by walking the objects.
  4. Emit a new, spec-compliant PDF with the recovered pages.

Recovery is best-effort: pages whose content streams were truncated may be dropped or open blank; encrypted PDFs whose encryption dictionary is destroyed cannot be recovered without the key.

Steps

  1. Open Repair PDF.
  2. Drop the broken file.
  3. Wait a few seconds while the byte scan completes.
  4. Download the repaired copy and open it in your usual viewer.

If repair doesn't help

  • Re-download the file — a truncated original is the most common cause.
  • Check the file starts with %PDF-1.x; if it doesn't, it's not actually a PDF (rename mistake).
  • For images inside a broken PDF, try PDF OCR after rasterizing what opens.

Frequently asked questions

Will Repair PDF fix an encrypted (password-locked) file?

Only if the encryption dictionary is intact and you know the password. Corruption inside the encrypted portion is unrecoverable by design.

Does repair lose pages?

It recovers every page whose objects survive. Pages whose content streams are truncated may be dropped.

Does it work offline?

Yes. Once the page loads, the WebAssembly repair runs without network.

Is my file uploaded?

No. Open DevTools → Network to verify — no request carries the file bytes.

Which PDF versions are supported?

1.0 through 1.7 (Extension Level 8), which covers effectively every PDF in circulation.

Related posts

← Back to blog