Results 1 to 4 of 4
Aug 18, 2006, 14:17 #1
- Join Date
- Aug 2006
- 0 Post(s)
- 0 Thread(s)
"The file is damaged and could not be repaired" when generating pdf
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.