"The file is damaged and could not be repaired" when generating pdf with ezpdf

This is not a question but may help if someone gets caught in the situation that I did.

I developed a php/mysql app about a year ago for a client. I am using fpdf to generate pdf formated reports. The app was running on 10 servers at 10 different sites with no problem.

Last week I installed the app on a new server at an 11th site. Same base software, config, etc. However, the pdf output was intermittently producing the error “The file is damaged and could not be repaired” when displaying the output. This error would occur about 5 out of 6 times both when the output was displayed using the browser plugin and when downloaded and displayed using Abobe reader.

The error occurred using IE and Firefox browsers on Windows. Netscape was no problem. All *nix browsers were fine.

I found the problem to be a small programming error I made a year ago. I forgot to call exit in the php script after generating the pdf output. There was some following html in the php file that got appended to the pdf file after the EOF marker. Since there was no problem up until last week, I never noticed the error.

I still have no idea why this worked sometimes. I’m guessing on the *nix systems the pdf viewer in use (not Adobe) ignores anything past the EOF marker. I have no clue for the Windows clients.

Hope this is of some help to someone.

This is a very old thread but I cant get my efpdf to work…

I’m working on a PC with firefox with acrobat or something and I it working fine…

On other pc’s with acrobat version of 10 or higher it doesnt work…

I get get this when generating the PDF:

“The file is damaged and could not be repaired”

The solution posted in the other thread maybe will work but where do I have to place the



Any help would be welcome

Thanks in advance

After you are done working with the ezpdf framework but before the closing ?> Also make sure there isn’t any whitespace after the ?> or remove the ?> entirely (as it is optional and may resolve your issue too)


Thanks for the fast reply…

I have three files…




Like you set I removed the ?> at the end of create.php but that is not working…

On my pc with acrobat it is still working…

But on a pc with version it is still giving an error like

“The file is damaged and could not be repaired”

Any other ideas?

Thanks in advance