title: Error when trying to merge two slide slides
body: <p>How do you merge two slide slides saved as a PDF? Specifically, I want to know how to add a second slide to a first slide. I tried copying the code in a Python Udemy course while changing the variables' names, I found one solution online that looked very, very not concise, and I glanced at a stack overflow thread that ended in there maybe not being a solution. I got an error four times when running Udemy code that one of my PDFs was corrupted and never got a slide added to another slide. The expected output is a pdf file with two slides, one from each pdf file. Here's a very rough excerpt of my code (attached). Note, the practice presentations I tried to merge I called ~sept-1.pdf and second-page.pdf + I changed the username in the file path to eliminate my nickname.</p>
  <h3>Goal: Add the one and only slide from pdf 2 and add it to the end of pdf 1.</h3>
  <h4>Import modules</h4>
  <p><code>!pip install PyPDF4</code> then <code>import PyPDF4</code></p>
  <h4>Change directory to desktop</h4>
  <pre><code>import os
  os.getcwd()
  
  os.chdir('/Users/mac_username_name/Desktop')
  os.getcwd()
  </code></pre>
  <h4>Stuff after chaging the directory to the desktop</h4>
  <h4>Adding to my desired PDF</h4>
  <pre><code>f = open('sept-1.pdf','rb')
  pdf_reader = PyPDF4.PdfFileReader(f)
  
  first_page = pdf_reader.getPage(0)
  
  pdf_writer = PyPDF4.PdfFileWriter()
  
  pdf_writer.addPage(first_page)
  
  pdf_output = open(&quot;newer.pdf&quot;,&quot;wb&quot;)
  
  pdf_writer.write(pdf_output)
  
  f.close()
  </code></pre>