Thursday, October 1, 2015

Using mutool to repair a PDF file that has corrupted xref table

Someone send me a PDF and I could not opened it on my Nexus 5 with Adobe's PDF reader (It suits me the best for a PDF viewer in the android phone).  But both XPDF and muPDF under Linux could opened it with some error message saying the xref table is corrupted and try to rebuild it. 

How could I repair the pdf file?  The first tool comes in my mind is pdftk, it failed to read the corrupted file and give exception.  Then I try pdf2ps, it failed either. 

Google shows me some one saying mutool from muPDF could repair it.  I have using muPDF for some time, it is the default PDF viewer in my Slackware desktop.  But I never take attention to the little tools come along with it, after man mutool, the following command save me:
mutool clean corrupted.pdf clean.pdf
The repaired PDF file is in clean.pdf.

P.S. muPDF does not come with Slackware, but it has a SlackBuild script.  For Windows user, muPDF provide windows version too.
Post a Comment