Tuesday, June 21, 2011

Solved? LaTeX Error: pdf file is damaged - attempting to reconstruct xref table

Update: Greater experience with this issue has given me greater clarity. The issue is not related to LaTeX. Getting this error message simply means that evince tried to access the PDF file while it was being written to by pdflatex or latex and found it in a damaged state. This happens if you have a large pdf file being generated with lots of text or a number of figures. There's nothing to worry about if you get this error message. You can safely ignore it.

---- Original Post Below ---

This is just a short note for anyone coming across this problem while doing LaTeX work.
Google doesn't have a decent explanation for why this message occurs. I don't have one either
but I have isolated the cause for my particular issue and I hopefully have a fix.

The error under discussion is:

Error: PDF file is damaged - attempting to reconstruct xref table... Error: Couldn't find trailer dictionary Error: Couldn't read xref table Error: PDF file is damaged - attempting to reconstruct xref table... Error: Couldn't find trailer dictionary Error: Couldn't read xref table

I hit this error while importing a PNG file exported from GIMP into my LaTeX thesis using the 
\includegraphics command. The PNG file probably had a few transparent pixels inserted due to
the editing process because the base image (which was unmodified) was imported without any
issue into the LaTeX PDF and this is something that LaTeX doesn't like.

I fixed this issue by simply removing the obnoxious PNG and converting that to a JPG. The 
problem got solved.

If it helps you, let me know in the comments! :)

5 comments:

  1. Q: Is the decision to do your report in Latex voluntary or guide-induced ?

    ReplyDelete
  2. Oh voluntary! I love the output. And haven't hit major roadblocks yet.

    ReplyDelete
  3. It's funny,

    It worked for me, but by the other way around. Changing .jpeg for .png!

    Thank you, very much. Greetings from Brazil.

    ReplyDelete
    Replies
    1. My pleasure! Glad to see that it helped someone.
      By the way, you can safely ignore that error message. It doesn't affect your output.

      Cheers!

      Delete
  4. Anonymous8:16 AM

    You just saved my life! I had it with with pdf figures..

    I would never have thought about changing these two figures!

    Thank you very much!!

    ReplyDelete