0

I want to create each page of a pdf file to a new pdf object. I am following the mentioned code snippet https://stackoverflow.com/a/490203/13291630 but here it is shown as the creation of a new file, but I want to just create a pdf object without creating a new file and just use that created pdf object as every other pdf. I hope this information helps, Can anyone help me out here.

Mr Anonymous
  • 75
  • 10

1 Answers1

1

If I understand correctly your purpose:

import pdfplumber
filename = 'path/to/your/PDF'
pages = []
with pdfplumber.open(filename) as pdf:
    for i, page in enumerate(pdf.pages):
        pages.append(page)

The list pages will contain an element of class page for every actual page of you PDF. You can then access their properties. Look at PDFPlumber Github page for more information

SilentCloud
  • 1,677
  • 3
  • 9
  • 28