Repair PDF

Rebuild a broken PDF's internal structure with qpdf — and read the known fault below before you rely on it.

Secure server processingPDFWorkingNo account needed

What this tool does

Repair PDF hands your document to qpdf, which reads it as forgivingly as it can and then writes a fresh copy from what it understood. When the cross-reference table is wrong, qpdf scans the file for object definitions and builds a new index from what it finds; stream lengths that disagree with the actual bytes are corrected, and a valid trailer is written at the end. Those are the faults behind most of the files a reader calls damaged.

One thing has to be said before any of that matters. qpdf signals a rebuild it had to improvise by exiting with a warning status rather than a clean one, and this service reads every non-zero exit as a failed job — so the repaired document qpdf has just written is discarded and you are shown "That PDF could not be processed." instead. The effect is backwards. A file whose cross-reference table is already sound passes through and is returned rewritten, while a broken startxref, shifted offsets, a truncated tail or a stream length that disagrees with the bytes present — the damage this tool is named for — ends the job with an error. That is a small change in the worker and it has not been made yet, so treat this as a tool for normalising files that still parse, and an unreliable one for the badly broken.

Nor can it conjure bytes that are not in the file. A download that stopped halfway, a copy off a failing disk, a save interrupted by a crash — in each case part of the document is simply absent, and rebuilding the index around the surviving objects is the most anyone can do. The work runs on the server: your PDF travels over an encrypted connection to a machine with qpdf installed, the upload is deleted the moment a job completes, and a sweep clears whatever is left — failed inputs and finished results alike — once the retention window passes. There is nothing to configure, because the cross-reference table is rebuilt on every write; hand it several PDFs and each one is sent as its own job and returned separately.

How to use it

  1. Add your PDFs. More than one is allowed — each becomes a separate job, within the 200 MB per-file upload ceiling. If a viewer asks for a password before showing an error, remove it with Unlock PDF first, because there is no password field here.
  2. Run the job. There are no options to weigh up. The same rebuilding pass runs every time, so the only variable is how much of your file survived.
  3. Read whatever comes back. A document qpdf parsed without complaint returns as your filename with -repaired appended. One it had to reconstruct ends in an error today, for the exit-status reason above — that error is a fault in this build, not a verdict on your file.
  4. Page through the result. Check the pages you care about before deleting the original, because a file that opens is not automatically a file that is complete.

Processing & privacy

Secure server processing. This operation requires temporary server processing.

Common use cases

A file that broke in transit

An upload cut short, a sync that half-finished or a copy off a dying USB stick leaves offsets pointing at the wrong bytes. Rebuilding the index around the objects that survived is the repair qpdf attempts, and it is also the case most likely to hit the error described above.

A reader that reports a damaged document

Messages about a corrupt PDF, a bad startxref or a file that could not be repaired all describe the same class of structural fault this rewrite addresses.

A PDF another service refuses to accept

Print shops, upload forms and converters are stricter than desktop viewers. Passing a still-readable file through qpdf normalises its structure, which often clears a rejection nothing else explained. This is the case that works dependably today.

A document produced by a rough generator

Scripts and older exporters emit PDFs that lenient readers tolerate and strict ones do not. One pass rewrites the file conventionally, provided qpdf can read it through without raising a warning.

Questions

Is my PDF uploaded?
Yes. The repair runs through qpdf on the processing service, so the document travels over an encrypted connection, is rebuilt there, and is removed by the retention sweep. Tools that need no upload, such as Merge PDF, are marked as running in the browser.
Why did my corrupt file come back as an error?
Because of a fault in the current build, not because the file was hopeless. qpdf exits with a warning status whenever it has had to reconstruct anything, the job runner treats any non-zero exit as a failure, and the rebuilt document is thrown away before it reaches you. Files that parse cleanly exit cleanly and are returned.
What damage is it meant to fix?
Structural damage: a cross-reference table with wrong offsets, a broken startxref, stream lengths that disagree with the bytes present, a missing or truncated trailer, and revision chains left inconsistent by repeated incremental saves. Most of those trip the error above as things stand.
My file opens now but pages are blank — what happened?
The index was rebuilt successfully and the page content was not there to rebuild. That is the honest limit of any repair: it restores the map, not the territory the map describes.
Why are there no settings?
Because none would do anything. qpdf rebuilds the cross-reference table on every write, and it has no way to discard a single unrecoverable page on request, so both controls were removed rather than left on the page doing nothing.
Can it repair a password-protected PDF?
No. There is no field to supply the password, so an encrypted document cannot be opened for rebuilding. Use Unlock PDF with the password you hold, then repair the result.
Does repairing change anything else in the document?
Bookmarks, form fields, annotations and metadata are copied across as objects rather than re-created, so they survive. Digital signatures do not: signing binds to the exact bytes of the file, and a rebuild produces new ones.
Will it make the file smaller?
Not deliberately. Superseded objects from earlier incremental saves are dropped as a side effect of writing a clean document, which can shave something off, but Compress PDF is the tool that sets out to reduce size.

Related tools

  • Merge PDF — Combine several PDFs into one document in the order you choose.
  • Split PDF — Split one PDF into separate documents by page range.
  • Compress PDF — Reduce PDF file size while preserving the quality that matters.
  • PDF to JPG — Export every page of a PDF as a JPG image.
  • JPG to PDF — Turn one or many JPG photos into a single PDF.
  • Protect PDF — Add a password and set permissions on a PDF.