SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "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.

    Scenario:
    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.

    Problem:
    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 9.0.0.332 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
    PHP Code:
    exit(); 
    ?

    Any help would be welcome

    Thanks in advance

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,234
    Mentioned
    154 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Joepiooo View Post
    This is a very old thread but I cant get my efpdf to work...

    I'm working on a PC with firefox with acrobat 9.0.0.332 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
    PHP Code:
    exit(); 
    ?

    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)

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Thanks for the fast reply...

    I have three files...

    Create.php

    class.ezpdf.php

    class.pdf.php

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

    On my pc with acrobat 9.0.0.332 it is still working...

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

    "The file is damaged and could not be repaired"

    Any other ideas?

    Thanks in advance


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •