Replace this: What happened? What were you trying to achieve?
Environment
Python 3.8
WSL Ubuntu 22.04
Windows11
pypdf 4.1.0
Issue
I generated a very simple pdf with libreoffice-writer :
test_image.pdf
In this pdf, there is two pages, one containing a small text, another containing an image.


I want to extract pdf pages and get the image only in the second page.
The code to reproduce the issue is here :
pdf = PdfReader(pdf_file)
for i,page in enumerate(pdf.pages):
print(f'--- Extracting page {i}')
print(page.extract_text())
print(len(page.images))
The result is bellow :
--- Extracting page 0
Test page 1
1
--- Extracting page 1
1
I expect that on page 0 there is 0 image in order to extract the image only from the second page.
I don't know if it is a normal behaviour.
How to do what i would like to obtain ?
Thanks,
Regards
Replace this: What happened? What were you trying to achieve?
Environment
Python 3.8
WSL Ubuntu 22.04
Windows11
pypdf 4.1.0
Issue
I generated a very simple pdf with libreoffice-writer :
test_image.pdf
In this pdf, there is two pages, one containing a small text, another containing an image.


I want to extract pdf pages and get the image only in the second page.
The code to reproduce the issue is here :
The result is bellow :
I expect that on page 0 there is 0 image in order to extract the image only from the second page.
I don't know if it is a normal behaviour.
How to do what i would like to obtain ?
Thanks,
Regards