from PyPDF2 import PdfFileReader, PdfFileWriter
def split(path, name_of_split):
pdf = PdfFileReader(path)
pdf_writer = PdfFileWriter()
for page in range(pdf.getNumPages()):
if page > 5:
pdf_writer.addPage(pdf.getPage(page))
output = f'{name_of_split}.pdf'
with open(output, 'wb') as output_pdf:
pdf_writer.write(output_pdf)
if __name__ == '__main__':
path = './emnlp2021.pdf'
split(path, 'NO')