anonymous
anonymous

Reputation: 193

appending %%EOF to a PDF file in python

I'm trying to open a PDF with pyPdf. I get the following error:

pyPdf.utils.PdfReadError: EOF marker not found

I thought that I should add the EOF myself. However, I don't want to write bytes. Isn't it OS specific? I want to call something like os.eof(). What do I write? This thread is not helpful.

Upvotes: 3

Views: 5419

Answers (1)

Tim Pietzcker
Tim Pietzcker

Reputation: 336168

PDF's EOF marker is a special string (%%EOF) that needs to appear in your PDF file. If it doesn't, you have a malformed PDF. This string separates the actual PDF contents from any additional data (embedded files etc.).

It has nothing to do with the EOF event you run into when reading any file up to its end.

Upvotes: 4

Related Questions