TG Edit-Pdf
TG Edit-Pdf
Advertisement

Repair PDF

Fix a corrupt or damaged PDF by rebuilding its file structure into a clean copy.

Advertisement

Fix a PDF that won't open

"The file is damaged and could not be repaired." "Failed to load PDF document." A PDF that opened fine last week suddenly refuses everywhere. More often than not the content of that file — your pages, text, images — is still intact, and what's broken is the bookkeeping around it. This tool rebuilds that bookkeeping.

Why PDFs break

A PDF ends with a cross-reference (xref) table: an index telling the viewer the exact byte position of every object in the file, plus a trailer pointing at that index. It's the file's table of contents, and it's fragile in a specific way — any process that truncates or appends bytes silently invalidates it:

  • Interrupted downloads and uploads cut the file off mid-stream, taking the trailer with it.
  • Email gateways, FTP in text mode, and sync conflicts can alter line endings or append junk, shifting every byte offset the xref table relies on.
  • Crashing generators — an app that died mid-export — leave a file with valid objects but a missing or half-written index.
  • Recovered/undeleted files often come back with garbage prepended or appended.

Strict viewers check the index first; if it doesn't match reality, they refuse the whole file — even though 99% of it is fine.

What repair does

The repair engine (Apache PDFBox's lenient parser) ignores the broken index entirely and scans the raw file for the objects themselves — pages, fonts, images, content streams. From what it finds, it rebuilds the document structure in memory and re-saves a clean, spec-compliant PDF with a fresh xref table and trailer. Bogus startxref offsets, junk before the %PDF header, garbage after %%EOF, missing trailers — all repaired this way. Your pages come through visually identical; only the file's internal structure is rewritten.

What repair can't do

Recovery is limited to what still exists in the file. If the bytes of a page's content stream were themselves destroyed — the second half of an interrupted download, sectors lost to disk corruption — those bytes are gone and no tool can invent them. Likewise an encrypted PDF whose password you don't have isn't "damaged", it's locked; if you do know the password, remove it first with [Unlock PDF](/unlock-pdf). If repair fails outright, the most productive fix is upstream: re-download the file, or re-export it from the application that created it.

After repairing

  • Re-save habit: if a colleague reports your file won't open but it works for you, run it through repair before resending — the clean re-save fixes structural quirks some generators produce.
  • A repaired scan that should be searchable can go straight into [OCR PDF](/ocr-pdf).
  • Long-term archiving of the recovered document? Convert it to the ISO archival format with [PDF to PDF/A](/pdf-to-pdfa).
  • Repair preserves size along with content — if the file was bloated before, [Compress PDF](/compress-pdf) will shrink it.

Files up to 100 MB are transferred over HTTPS and deleted after processing. If the file is too damaged to parse, you get an error — never a half-broken download.

How it works

  1. Upload the PDF that won't open or shows an error message.
  2. Click Repair PDF — the file is parsed leniently and its structure rebuilt.
  3. Download the repaired copy and open it in any PDF viewer.

Frequently Asked Questions

Structural corruption: broken or missing cross-reference (xref) tables, bogus startxref offsets, truncated trailers, and junk bytes before the %PDF header or after %%EOF. The parser scans the raw objects, rebuilds the document structure, and re-saves a clean, spec-compliant file.

Content that is genuinely missing can't be reconstructed — a half-downloaded file or one whose page streams were overwritten by disk corruption has lost those bytes for good. Repair recovers everything still present in the file; it can't invent what isn't there.

No. Recovered pages keep their text, fonts, images and layout exactly — only the file's internal structure (xref table, trailer, object offsets) is rewritten. The output is the same document, just structurally valid again.

Many viewers refuse a file whose cross-reference table doesn't match reality, even when the page content is fine. Repair parses leniently, ignores the broken bookkeeping, and writes fresh, correct structure — so strict viewers accept the result.

Then the file is too damaged for automatic recovery — typically the header or the object data itself is destroyed. Try re-downloading or re-exporting the file from its source. Nothing is stored on our servers either way.

Related PDF tools

Advertisement
Advertisement