Python Forum
PDFplumber - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: PDFplumber (/thread-30732.html)



PDFplumber - pprod - Nov-03-2020

Hello everyone,

A beginner question: I have managed to open an unstructured pdf with pdfplumber, but I have only been able to print one page at at a time. I would like to print more than one page at a time or all pages if possible and inspect them in the Python console. Is this possible? Thanks!

with pdfplumber.open (r'C:\Users\Me\file.pdf') as pdf:
    page = pdf.pages[0] #How can I print more than one page at a time?
    text = page.extract_text()
    print(page.extract_text())



RE: PDFplumber - Atekka - Nov-03-2020

(Nov-03-2020, 09:24 AM)pprod Wrote: Hello everyone,

A beginner question: I have managed to open an unstructured pdf with pdfplumber, but I have only been able to print one page at at a time. I would like to print more than one page at a time or all pages if possible and inspect them in the Python console. Is this possible? Thanks!

with pdfplumber.open (r'C:\Users\Me\file.pdf') as pdf:
    page = pdf.pages[0] #How can I print more than one page at a time?
    text = page.extract_text()
    print(page.extract_text())

This should do the trick
with pdfplumber.open (r'C:\Users\Me\file.pdf') as pdf:
    for page in pdf.pages:
        print(page.extract_text())
        print()



RE: PDFplumber - pprod - Nov-10-2020

(Nov-03-2020, 03:59 PM)Atekka Wrote:
(Nov-03-2020, 09:24 AM)pprod Wrote: Hello everyone,

A beginner question: I have managed to open an unstructured pdf with pdfplumber, but I have only been able to print one page at at a time. I would like to print more than one page at a time or all pages if possible and inspect them in the Python console. Is this possible? Thanks!

with pdfplumber.open (r'C:\Users\Me\file.pdf') as pdf:
    page = pdf.pages[0] #How can I print more than one page at a time?
    text = page.extract_text()
    print(page.extract_text())

This should do the trick
with pdfplumber.open (r'C:\Users\Me\file.pdf') as pdf:
    for page in pdf.pages:
        print(page.extract_text())
        print()

Thanks a lot. It worked!