Fix "PDF Structure 40: Invalid reference table (xref)" Error
Error message: Error [PDF Structure 40]: Invalid reference table (xref)
Fix “PDF Structure 40: Invalid reference table (xref)” Error
PDF-XChange Editor has refused to open your file with the error Error [PDF Structure 40]: Invalid reference table (xref). The same file might open fine in Adobe Acrobat or your browser, which is why this error feels arbitrary. It isn’t — the file’s internal index is damaged, and PDF-XChange is stricter about it than Acrobat. The fix takes a minute or two.
Quick fix
The fastest path is to let Acrobat repair the file for you, then re-open in PDF-XChange:
- Open the PDF in Adobe Acrobat or Adobe Reader. Acrobat automatically attempts to rebuild the cross-reference table when it detects damage and will open the file silently in most cases.
- In Acrobat Pro, choose
File > Save Asand save the document to a new filename. The saved copy contains a clean xref. (Acrobat Reader can open and view but cannot save a repaired copy — you need Acrobat Pro for this step, or use the alternative below.) - Open the new file in PDF-XChange Editor.
If you don’t have Acrobat Pro, use the next strategy.
If that didn’t work
Rebuild the xref directly with qpdf. It is free, cross-platform, and the result is identical to what Acrobat would produce. After installing qpdf, run:
qpdf --linearize input.pdf output.pdf
--linearize forces qpdf to read the entire file, rebuild the cross-reference table from scratch, and write a clean output. Open output.pdf in PDF-XChange Editor — the error will be gone. See the complete guide to qpdf for installation steps and other recipes.
To inspect the file before repairing, run qpdf --check input.pdf. If qpdf reports Attempting to reconstruct cross-reference table and exits with code 3 (“operation succeeded with warnings”), the file is recoverable. Exit code 2 means the damage is too severe for structural repair.
If the file came from a download
Transit corruption is the most common single cause of this error. Before any repair tool, redo the download:
- If the file came from a website, download it directly (right-click
Save link as) rather than viewing it inline through a browser plugin. - If the file came from email, save the attachment to disk first and open it from there, rather than opening it through the email client’s preview.
- If the file came from cloud storage, download a fresh copy rather than relying on a cached version.
A clean re-download fixes a substantial fraction of “PDF Structure 40” cases without touching repair tools. It takes seconds and rules out the most common cause.
Update PDF-XChange Editor
PDF-XChange has gradually improved its tolerance for non-standard PDF constructs across releases. If you’re running an older version (anything before v8), update to the current release. Some files that older PDF-XChange rejects are accepted by current versions without complaint.
Why this happens
A PDF stores its content as a collection of numbered objects — pages, fonts, images, metadata — and uses a small index near the end of the file called the cross-reference table (the “xref”) to record where each object starts. When you open a PDF, the reader reads the xref first to navigate everything else.
When the xref is malformed — corrupted bytes, wrong offsets, missing entries — the reader can’t find the rest of the document. Adobe Acrobat tolerates a remarkable amount of xref damage and rebuilds it silently. PDF-XChange is stricter and surfaces the error rather than auto-repairing. The underlying file content is usually intact; the index pointing to it is the only thing wrong.
Common causes of xref damage in this specific error:
- Interrupted downloads. The last few kilobytes of the file never arrived, taking the trailing xref with them.
- Server-side PDF generators that didn’t terminate cleanly. Common with web-based “export to PDF” tools, especially older ones.
- Editing with multiple PDF tools in sequence. Each tool may append a new xref; conflicting chains confuse stricter readers.
- PDF generators that produce non-spec-compliant output. Acrobat tolerates these; stricter readers don’t.
The error code 0x82142717 accompanies the “Invalid reference table” variant; 0x82140002 accompanies “Invalid file format”; 0x821427B1 accompanies “Invalid property type”. All three are variants of the same underlying problem.
A note on online repair services
You will see ads for online PDF repair services in search results for this error. They work, sometimes — but they require uploading your file to a third-party server. For sensitive documents (contracts, financial records, anything containing personal data), use qpdf locally instead. The result is the same and the file never leaves your machine.
Preventing this in future
A few habits substantially reduce how often you see this error:
Save downloads to disk before opening them, rather than opening files directly from a browser preview or an email client’s attachment viewer. The intermediate save catches truncated downloads early.
When generating PDFs from web-based tools, prefer ones that produce the file as a complete download rather than streaming it to the browser. Streamed generation is more prone to mid-transfer truncation.
If you regularly receive PDFs from a specific source that consistently triggers this error, the problem is on the producer side. Mention it to whoever generated them — their PDF library is producing non-compliant output, and a fix at the source is more durable than repairing every file.
Related issues
If your file produces a different xref-related error such as Cross-reference table not found or an Expected n 0 obj / expected endobj message from qpdf, the underlying problem is the same family but the diagnostic detail differs. The PDF repair complete guide covers the architecture of PDF files and what “repair” actually does at the byte level.
Last verified: April 2026