Khallas

Repair a PDF file

A file that refuses to open, or shows a corruption error? Many of those cases are structural, not content damage: a broken index, corrupt objects, an interrupted save. We re-read the file leniently and write a structurally clean copy of its pages. What we cannot do is recover content that is not in the file at all.

Drop your files here

Files are processed on your device and never uploaded

Runs in your browser. Your file never leaves your device.

You can process several files at once, up to 3.

100% local, nothing uploaded

Three steps, that's it

  1. Drop the damaged file in the tray

  2. Press Repair the file

  3. Download the rebuilt copy and try opening it

What does the repair PDF tool do?

The tool takes a file that refuses to open and re-reads it leniently: it steps past a corrupt object instead of stopping at the first one, and it searches the whole file for the pages instead of trusting a broken cross-reference table. Every page it finds is then copied into a new document that is written from scratch with a clean structure. The result is an ordinary PDF, saved under your original file name with a word after it saying this is the rebuilt copy, so it never replaces the original on your device.

We measured what survives on a test file whose cross-reference table was deliberately wrecked: all three pages came back, the text of every page came back exactly as it was written, and the page size was unchanged. All of it runs inside your browser, so the damaged file is not uploaded to a server and never passes through Khallas. That matters more here than almost anywhere, because the files people try to rescue are bank statements, contracts and official documents, and they are handing them over at their worst moment.

Why a PDF stops opening

Four causes cover most of what we see, and three of them are structural, which is what this tool fixes. The first is a broken cross-reference table: at the end of every PDF is a table saying where each part of the file sits, and when those positions are wrong the reader rejects the whole file even though the pages are intact and in place. The second is corrupt objects and object streams that will not unpack, so a strict reader stops at the first one. The third is an interrupted save, or an edit appended to the file that never finished, which is what happens when a program is closed or a phone runs out of battery mid-save.

The fourth cause is different, and it cannot be repaired: a truncated file, one that was copied or downloaded incompletely so only part of it is on your device. What is missing is not in the bytes you hold and cannot be invented. We tried it: we cut the end off a healthy file and ran it through, and the tool refused to rebuild it and showed the could-not-read message rather than quietly handing back a partial copy. That is deliberate. A file that opens with half the document missing is worse than a clear message telling you to get another copy from the source.

When you need to repair a PDF

The most common case by far is an attachment that arrived, or was saved, incomplete: a file pulled from a government portal when the connection dropped before it finished, an email attachment whose tab was closed mid-download, a file copied to a USB stick that was pulled out too early, or a file from a scanner app that was closed before it finished writing. In all of those the damage is usually structural and the pages themselves are sitting there waiting for something to read them.

There is a second case that turns up constantly in offices: a file that opens for you and not for anyone else, or opens in a browser and is rejected by the portal you are uploading to. That is usually a file whose structure breaks the specification, with a lenient reader letting it pass and a strict one refusing. Rebuilding writes the file out in one clean form, and both sides then accept it. A file that will not open because it asks for a password is not a repair case at all; the page says so and hands you across to the unlock tool with your file still in hand.

What the rebuilt copy keeps, and what it drops

It keeps every page in order, with each page's text, images, size and rotation. We measured what it drops on a test file that carried a document title, an author name, a bookmark outline and a filled form field: after rebuilding, the form field count was zero, the outline was gone, and both the title and author fields were empty. The box itself is still drawn in place on the page, but it is no longer a field you can type into.

The reason is that the tool copies pages, not the document. Anything attached to the document itself, such as the outline, the interactive form, embedded attachments and the document information, does not travel with a page. That is a fair price when the alternative is a file that will not open at all, but it is worth knowing before you delete your damaged copy. Keep the original until you have opened the new one and confirmed it carries what you actually need.

How to repair a damaged PDF, step by step

  1. Keep a copy of the damaged file exactly as it is before anything else. Repairing does not change your original, but having a spare copy leaves you a second attempt if you try another route later.

  2. Open the repair PDF page and drop the file into the tray, or tap the tray to pick it from your device or from the Files app on a phone.

  3. Drop the rest of your damaged files in alongside it if you have more than one; each file is rebuilt on its own within the same run.

  4. Press Repair the file and wait a few seconds; a progress bar runs and then the result card appears with the size of the new file.

  5. Open the preview and page through it: check that the page count is the one you expect and that the last page is there, because a missing tail is the first sign the file was truncated.

  6. Download the rebuilt copy and open it in the reader that rejected the original, or upload it to the portal that refused it. That is the real test.

Limits worth knowing

  • A truncated file cannot be repaired. If part of the file never reached your device, nothing here can compose it, and you get the could-not-read message instead of a partial copy. The only fix is a fresh copy from the source.
  • A password-protected file cannot be rebuilt while it is locked. Remove the password first with the unlock PDF tool if you know it, then try again here. The message you get carries a link that takes your file across with it.
  • Bookmarks and the outline do not travel to the new copy, and neither do embedded attachments or the document information such as title and author. The pages are what gets copied.
  • Form fields do not stay fillable after a rebuild, even though the box stays drawn on the page. If a form is filled in and you need the answers to arrive as written, flatten it with the flatten form tool before it ever needs repairing.
  • A digital signature stops being valid after any change to a file, and rebuilding is a complete change. A digitally signed file should be requested again from its source rather than repaired.
  • Repair does nothing for a file that is not a PDF underneath. An image renamed with a PDF extension is still an image, and its route is the images to PDF tool, not this one.
  • You can drop more than one file into a run and each is rebuilt on its own, up to 3 files in one run. The ceiling is technical, not commercial: every file is read and rewritten inside your own browser. The result is then a ZIP, so no preview appears before you download.

Common problems and their fixes

The file will not open and the reader says it is damaged

This is the case the tool was built for. Drop the file here, press Repair the file, then open the result in the same reader that rejected the original. If it opens, the fault was structural. If you get the could-not-read message instead, the file is truncated and you need another copy from its source.

I repaired it and it still will not open

The file was most likely downloaded or copied incompletely. Fetch it again from its source on a stable connection and compare the size of the new file with the old one; a large difference confirms the first was truncated. If it reached you over WhatsApp or email, ask the sender to resend from the original on their device rather than from the copy you received.

It says the file is password protected

The file is encrypted and cannot be rebuilt in that state. The message carries a link to the unlock PDF tool that takes your file with it in one press, so open it there with the password and bring the unlocked copy back to the repair page. If you do not know the password there is no route here, and the file has to come from its source.

The file opens for me but not for the office I sent it to

Your reader is lenient about a structure that breaks the specification and theirs is strict. Run it through repair even though it opens for you, because rebuilding writes it out in one clean form, then send the new copy. If the rejection was about size rather than structure, the compress PDF tool is the route, and it can hold to the exact limit the office set.

The rebuilt copy opens but the title, bookmarks or form fields are gone

That is expected and deliberate: the tool copies pages, not the document, so anything attached to the document itself does not travel. The pages, their text and their images are all there. If the new copy needs an outline, build one with the bookmarks tool, and if you need a filled form, flatten its values before repairing rather than after.

The new file is a different size from the original

That is normal and does not mean content was lost. The file is written out again with its objects packed compactly, so it usually shrinks, because leftovers from old edits and orphaned copies inside the file are dropped. It can occasionally grow if the original was packed more tightly still. Check the page count in the preview; that is the number that matters, not the bytes.

The file arrived with a PDF extension but it is really an image

Repair cannot help, because the file is not a PDF on the inside. Convert the image with the images to PDF tool and you get a sound file on the first try. And if what you want is the text in the image rather than the picture of it, the Arabic OCR tool reads it and gives you text you can select and copy.

Frequently asked questions

What does this actually fix?

The file's structure rather than its content: a broken cross-reference table pointing the reader at the wrong positions, corrupt objects and object streams that a strict reader stops at, and the leftovers of an interrupted save. Those are the most common causes of a file that will not open. We re-read the file leniently and copy every sound page into a new document written from scratch. Content that is missing from the bytes cannot be invented back.

My file is password-protected. Can it be repaired?

Not while it is locked, because an encrypted file's structure cannot be read at all before it is decrypted. Unlock it first with the unlock PDF tool if you know the password, then bring the unlocked copy back to the repair page. The message you get here carries a link that takes your file across in one press. If you do not know the password, the file has to come from its source.

I tried and it still will not open. What now?

The file is most likely truncated: copied or downloaded incompletely, so only part of it is on your device. Fetch it again from its source on a stable connection and compare the size against the old copy, because a large difference confirms it. If it reached you over WhatsApp, ask the sender to resend from the original on their device. Not every kind of damage is repairable, and we do not claim otherwise.

Is my damaged file uploaded to a server?

No. The whole rebuild runs inside your browser on your own device, so the file is not uploaded to any server, never passes through Khallas, and no copy of it is kept by us. Close the page and nothing is left behind, because the file never left your device in the first place. That matters more in this tool than in most, because what people are trying to rescue is usually a statement, a contract or an official document.

Will repairing lose the text or images in my file?

No. Pages are copied as they are, with their text, images, size, rotation and order intact. We measured that on a test file whose cross-reference table was deliberately wrecked: every page came back and the text of each page came back as written. What does drop is anything attached to the document rather than to a page: the outline and bookmarks, interactive form fields, embedded attachments, and document information such as title and author.

Why is the repaired file a different size from the original?

Because the file is written out again with its objects packed compactly instead of in the arrangement it had. It usually shrinks, since leftovers from old edits and orphaned copies inside the file are dropped during the rebuild, and it can occasionally grow if the original was packed more tightly still. A size difference alone does not mean content was lost. The number that matters is the page count in the preview.

My file is an image renamed with a PDF extension. Will repair help?

No, because the file is not a PDF on the inside, so there is no structure to rebuild. Convert the image with the images to PDF tool and you get a sound file on the first attempt, with several images in one document if you want. If what you want is the text rather than the picture of it, the Arabic OCR tool returns text you can select and copy.

Guides for this tool

Tools that go with this one

All tools

Every tool runs inside your browser without uploading the file.

More uses

From the blog