I have this code that returns an error
packet = io.BytesIO()
c = canvas.Canvas(packet)
packet.seek(0)
new_pdf = PdfFileReader(packet)
template = PdfFileReader(open('path_to_template'), "rb")
output = PdfFileWriter()
page = template.getPage(0)
page.mergePage(new_pdf.getPage(0))
output.addPage(page)
outputStream = open(output_path, "wb")
output.write(outputStream)
outputStream.close()
This is the error in details
PyPDF2.utils.PdfReadError: Cannot read an empty file