How to display pdfplumber.display.PageImage in a for loop #472
Unanswered
PatrykKoperski94
asked this question in
Q&A
Replies: 1 comment
-
Hi @PatrykKoperski94 Assuming by display you refer to saving the page as an image, you may use the following import pdfplumber
pdf = pdfplumber.open("file.pdf")
for page in pdf.pages:
im = page.to_image()
im.save(f"{page.page_number}.png", format="PNG") It would save images as |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I would like to output all pages in a pdf into the console using a for loop like so:
However, everything works perfectly when I do it one by one 'manually' like so:
However, I notice that there is a small loading time with each image, and if I run the three lines above at once, only the last one gets displayed. Can someone explain what actually happens here?
Is there a way to display each image in the console using an iterative approach?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions