title: EOF marker not found - How to fix in PyPDF and PyPDF2?
body: <p>I'm attempting to combine a few PDF files into a single PDF file using Python. I've tried both PyPDF and PyPDF2 - on some files, they both throw this same error:</p>
  <blockquote>
  <p>PdfReadError: EOF marker not found</p>
  </blockquote>
  <p>Here's my code (page_files) is a list of PDF file paths to combine:</p>
  <pre class="lang-py prettyprint-override"><code>from PyPDF2 import PdfReader, PdfWriter
  
  writer = PdfWriter()
  for path in [&quot;example1.pdf&quot;, &quot;example2.pdf&quot;]:
      reader = PdfReader(path)            
      for page in reader.pages:
          writer.add_page(page)            
  
  with open(&quot;out.pdf&quot;, &quot;wb&quot;) as fp:
      writer.write(fp)
  </code></pre>
  <p>I've read a few StackOverflow threads on the topic, but none contain a solution that works. If you've successfully combined PDF files using Python, I'd love to hear how.</p>