split pdf code example

Example 1: pdf splitter online

Hope you have a nice day! These are some best pdf editing sites.
1) https://www.sodapdf.com/split-pdf/
2) https://www.ilovepdf.com/split_pdf

Example 2: python split pdf pages

from PyPDF2 import PdfFileWriter, PdfFileReader

inputpdf = PdfFileReader(open("document.pdf", "rb"))

for i in range(inputpdf.numPages):
    output = PdfFileWriter()
    output.addPage(inputpdf.getPage(i))
    with open("document-page%s.pdf" % i, "wb") as outputStream:
        output.write(outputStream)

Example 3: pdftk split pdf

pdftk full-pdf.pdf cat 12-15 output outfile_p12-15.pdf