Why a PDF gets damaged
A PDF is not read from top to bottom like a text file. At its end sits an index, the cross-reference table, that gives the exact byte position of every object (pages, fonts, pictures), followed by a trailer that names the first object to read and a startxref line that says where the index starts, then the %%EOF marker. The PDF standard, ISO 32000-1, describes this layout in section 7.5. So the damage that matters most is usually at the end: a download that stopped early, an attachment cut by a mail server, a USB stick pulled out during copying, or an app that added data to the file without updating the index. A single wrong number in the index can make a strict reader refuse a file whose pages are all intact.
What this tool repairs, and how
Instead of trusting the index, the repair reads the file from the first byte to the last and collects every object it can parse, the way a careful reader recovers a book with a torn table of contents. Bytes saved in front of %PDF (an e-mail or web header, for example) are dropped, and a missing or damaged %PDF header line is written again. When the file stops in the middle of an object, the cut part is set aside, and if it is a compressed object stream the objects that arrived whole are kept. Streams whose declared length is wrong are measured again from the endstream keyword. Objects that cannot be read at all are removed; the standard says a reference to a missing object is read as an empty value, so the rest of the file still works. The document catalog and title information are found again if their pointers were lost, and a broken page list is rebuilt from the page objects that survived, keeping their order and their inherited size and resources. Page drawing instructions that were damaged are cut back to the last complete line. Finally a new file is written with a fresh index, trailer and %%EOF, and checked by opening it again before you download it.
The report: what was fixed and what was lost
Each file gets its own report. "What was fixed" lists the faults found, such as how many index entries pointed to the wrong place or how many bytes of junk were removed. "What was lost" is just as plain: how many of the pages the file says it has could not be recovered, which pages came back blank or only partly drawn, and how many fonts or pictures were missing. If a file shows no damage at all, we say so and do not pretend to have fixed something: the problem may be the app you used to open it, or an older copy. Every repaired file in our tests is opened again by two independent PDF readers, Poppler and pypdf in strict mode, and its text is extracted to make sure the words, including Arabic, are still there.
The image method, used only as a last resort
Sometimes the structure is too far gone to rebuild, yet a viewer can still draw some pages. Then the tool asks pdf.js, the PDF engine used by Firefox, to draw every page it can at 150 dpi and puts each picture on a page of the same size in a new PDF. This is labelled clearly, because it has a price: the text becomes part of a picture, so it can no longer be selected, searched or copied, links and form fields are gone, and the file may be larger. When a structural repair lost pages or content, you can try the image method as well and keep whichever copy is better. If you need searchable text again afterwards, run the image version through OCR.
What cannot be repaired
No tool can bring back bytes that are not in the file. If a download stopped at 40%, the pages stored in the missing 60% are gone, and the report tells you how many. A file that was overwritten with zeros, or a Word or image file renamed to .pdf, has nothing to rebuild. Password-protected PDFs are encrypted, so their objects cannot be checked or rewritten without the password: unlock the file first if you know the password, then repair the unlocked copy. The best fix for a broken download is often a fresh copy from the sender or the portal; repair is for when no other copy exists.
Privacy and limits
The repair runs entirely in your browser with pdf-lib and pdf.js; the file is never uploaded, which matters for contracts, bank statements and ID copies. Files up to 200 MB are accepted. In our tests on an ordinary computer a 5-page file is repaired in well under a second and a 200-page file in about a second. You can drop several files at once and download each one separately.