Fixing PDF EOF Errors with PyPDF

Brett Bowman bnbowman at
Mon Nov 15 00:30:38 CET 2010

Hey all, I'm trying to read a library of my company's PDFs, but about a
third of them can't be opened.  PyPDF (v1.12) spits out this error:

pyPdf.utils.PdfReadError: EOF marker not found

I searched for the answer via google, but all I found was this link:  She suggests fixing the problem by
appending an EOF marker like so:

def fixPdf(pdfFile):
        fileOpen = file(pdfFile, "a")
        return "Fixed"
    except Exception, e:
        return "Unable to open file: %s with error: %s" % (pdfFile, str(e))

Which appears to successfully append all of the files, as the exception is
never triggered and "Fixed" always returned,
but subsequent attempts to open the files all failed.  Yet all of those
files can be open successfully with Adobe Acrobat Reader.
Is this code inorrect or is there some other way to correct this error?  Or
does the code depend on the system?
(I'm using Windows XP, but I believe the author was using a *nix)

Brett Bowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list