
How to Repair Corrupted or Damaged PDF Files

Michael Foster
Content Creator & Tutorial Expert
Corrupted PDFs can result from interrupted downloads, storage failures, or software crashes. This guide covers practical methods for repairing damaged PDFs and recovering content in 2026.
Table of Contents
A corrupted PDF is a frustrating experience. You try to open an important document and get an error message, a blank page, or a partially loaded file. Corruption can happen for many reasons — interrupted downloads, storage failures, software crashes, or incomplete writes. This guide covers practical methods for repairing damaged PDFs and recovering as much content as possible.
Understanding PDF Corruption
PDFs can be corrupted in different ways, and understanding the type of corruption helps determine the best repair strategy:
Types of PDF Corruption
- Header corruption: The PDF header (the first few bytes that identify the file as a PDF) is damaged. The file may not be recognized as a PDF at all.
- Cross-reference table corruption: The table that maps byte offsets to objects within the file is damaged. The PDF may open partially or not at all.
- Object corruption: Individual objects (pages, images, fonts) within the PDF are damaged. Some pages or elements may not render.
- Trailer corruption: The trailer (which points to the cross-reference table and root object) is missing or damaged. The PDF may not open.
- Incomplete file: The file was not fully written or downloaded. It may be missing the end of the document.
- Encoding corruption: The file was transferred or stored with incorrect encoding, corrupting the binary data.
Common Causes of Corruption
- Interrupted downloads: Network issues during download can produce incomplete or corrupted files.
- Storage failures: Bad sectors on hard drives, failing USB drives, or corrupted cloud storage.
- Software crashes: The application creating the PDF crashed before the file was fully written.
- Email encoding issues: Some email systems corrupt PDF attachments during transmission.
- File transfer issues: FTP or other transfer protocols can corrupt binary files if not configured correctly.
- Virus or malware: Malicious software can corrupt files.
Method 1: Basic Repair Techniques
Start with the simplest methods before moving to more advanced techniques.
Re-download or Re-copy the File
If the corruption happened during download or transfer, re-downloading or re-copying from the original source may fix the problem. Always try this first — it is the simplest and most effective fix for download-related corruption.
Try a Different PDF Viewer
Different PDF viewers have different tolerance for corruption. If one viewer cannot open the file, try another:
- Adobe Acrobat Reader: The official PDF viewer, with good corruption tolerance.
- Firefox browser: Has a built-in PDF viewer that can sometimes open corrupted files.
- Chrome browser: Another built-in viewer with different error handling.
- Foxit Reader: A lightweight alternative that may handle some corruption better.
- SumatraPDF: A minimal viewer known for opening damaged PDFs that other viewers reject.
Open and Save in a Different Viewer
If a viewer can open the corrupted PDF (even partially), saving a copy may produce a clean file:
- Open the PDF in a viewer that can read it.
- Use "Save As" or "Print to PDF" to create a new copy.
- The new copy may have the corruption repaired.
Method 2: Use PDF Repair Tools
Specialized repair tools can rebuild damaged PDF structures.
Using Adobe Acrobat Pro
- Open Adobe Acrobat Pro.
- Go to File > Open and select the corrupted PDF.
- Acrobat Pro may automatically attempt to repair the file.
- If it opens, go to File > Save As and save a new copy.
- If it does not open, try the "Recovery" option in the File menu (if available in your version).
Using Online PDF Repair Tools
Several online tools specialize in PDF repair:
- Upload the corrupted PDF.
- The tool analyzes the file and attempts to rebuild the structure.
- Download the repaired PDF.
- Verify the content — some tools may recover only partial content.
Using qpdf for Structure Repair
qpdf can rebuild the cross-reference table and repair some structural issues:
qpdf --check corrupted.pdfThis checks the PDF for errors and reports them. To attempt a repair:
qpdf --linearize corrupted.pdf repaired.pdfOr:
qpdf --optimize-images corrupted.pdf repaired.pdfqpdf is particularly effective for cross-reference table corruption and can often rebuild the file structure even when the original is damaged.
Using Ghostscript for Repair
Ghostscript can re-process a PDF and produce a clean copy:
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOUTPUTFILE=repaired.pdf corrupted.pdfGhostscript reads the PDF content and writes a new, clean PDF. This can fix many types of structural corruption, though it may not preserve all features (bookmarks, form fields, etc.).
Using mutool (MuPDF)
mutool can clean and repair PDFs:
mutool clean corrupted.pdf repaired.pdfThis rewrites the PDF with a clean structure, removing damaged or unnecessary objects.
Method 3: Recover Content from Corrupted PDFs
If the PDF cannot be fully repaired, you may still be able to recover the content.
Extract Text
If the PDF has a text layer, you can extract the text even if the visual layout is damaged:
pdftotext corrupted.pdf recovered_text.txtThis extracts all readable text from the PDF into a plain text file. You can then reformat the text in a new document.
Extract Images
If the PDF contains images, you can extract them:
pdfimages -j corrupted.pdf recovered_imgThis extracts all images from the PDF as JPG files. You can then reassemble them into a new document.
Convert to Another Format
Converting the corrupted PDF to another format may bypass the corruption:
# Convert to Word
pdftotext -layout corrupted.pdf output.txt
# Convert to images
pdftoppm -jpeg -r 150 corrupted.pdf pageIf the conversion succeeds, you can work with the converted file and recreate the PDF if needed.
Use OCR on Rendered Pages
If the PDF can be rendered (even partially), you can convert pages to images and run OCR:
- Use a viewer that can open the corrupted PDF.
- Take screenshots or export pages as images.
- Run OCR on the images to recover text.
- Reassemble the text into a new document.
Method 4: Manual Repair Techniques
For advanced users, manual repair is possible but requires understanding of the PDF file format.
Fix the Header
If the file is not recognized as a PDF, the header may be damaged. The first bytes of a PDF should be `%PDF-1.x` (where x is the version number). You can fix this with a hex editor:
- Open the file in a hex editor.
- Check the first bytes — they should be `25 50 44 46 2D` (which is `%PDF-`).
- If they are different, replace them with the correct header.
- Save the file.
Rebuild the Cross-Reference Table
If the cross-reference table is corrupted, qpdf or Ghostscript can rebuild it. If you need to do it manually, you would need to parse the entire file and rebuild the table, which is complex and error-prone.
Append the EOF Marker
PDFs end with `%%EOF`. If this marker is missing (due to incomplete writing), appending it may help:
echo "%%EOF" >> corrupted.pdfThis is a simple fix that sometimes works for incomplete files.
Preventing PDF Corruption
Proper File Handling
- Download completely: Ensure downloads finish before opening files.
- Safe storage: Use reliable storage media and cloud services.
- Proper ejection: Always safely eject USB drives before removing them.
- Avoid concurrent access: Do not have multiple applications writing to the same file simultaneously.
Regular Backups
Keep backups of important PDFs. If a file becomes corrupted, you can restore from backup. Use automated backup solutions for critical documents.
Verify After Creation
After creating a PDF, open it to verify it is not corrupted. This is especially important for documents created by automated processes or scripts.
Use Reliable Software
Create PDFs with reputable software. Poorly written PDF generators can produce files with structural issues that are more prone to corruption.
Conclusion
Repairing a corrupted PDF is not always possible, but many files can be recovered using the techniques in this guide. Start with the simplest methods — re-downloading, trying different viewers, and using repair tools like qpdf and Ghostscript. If the file cannot be fully repaired, extract as much content as possible using text and image extraction tools. And to prevent future corruption, handle files carefully, maintain backups, and verify PDFs after creation.
Sources & References
About the Author

Michael Foster
Content Creator & Tutorial Expert
Michael creates in-depth tutorials and guides that make complex tools accessible to everyone. He has a passion for teaching and clear communication.
Frequently Asked Questions
Can a corrupted PDF be repaired?
Why does my PDF say it is corrupted?
How do I recover text from a corrupted PDF?
Can I prevent PDF corruption?
Start working smarter today
Join 500,000+ users who trust VisualDocs for their daily image and PDF workflows.

