An exception occurs when merging the joint pdf with itself:
File "/home/jf/.local/lib/python3.10/site-packages/pypdf/_writer.py", line 2863, in merge
elif dest["/Page"].indirect_reference.idnum in srcpages:
AttributeError: 'NumberObject' object has no attribute 'indirect_reference'
Environment
Which environment were you using when you encountered the problem?
$ python3 -m platform
Linux-5.19.0-35-generic-x86_64-with-glibc2.35
$ python3 -c "import pypdf;print(pypdf.__version__)"
3.10.0
Code + PDF
This is a minimal, complete example that shows the issue:
from pypdf import PdfWriter
merger = PdfWriter()
for pdf in ["tmp.pdf", "tmp.pdf"]:
merger.append(pdf)
merger.write("merged-pdf.pdf")
merger.close()
Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!
Traceback
This is the complete Traceback I see:
python3 test.py
Traceback (most recent call last):
File "/home/jf/CentraleSupelec/Mention_Cyber/syllabus/test.py", line 5, in <module>
merger.append(pdf)
[tmp.pdf](https://github.com/py-pdf/pypdf/files/11799685/tmp.pdf)
File "/home/jf/.local/lib/python3.10/site-packages/pypdf/_writer.py", line 2767, in append
self.merge(
File "/home/jf/.local/lib/python3.10/site-packages/pypdf/_utils.py", line 439, in wrapper
return func(*args, **kwargs)
File "/home/jf/.local/lib/python3.10/site-packages/pypdf/_writer.py", line 2863, in merge
elif dest["/Page"].indirect_reference.idnum in srcpages:
AttributeError: 'NumberObject' object has no attribute 'indirect_reference'
tmp.pdf
An exception occurs when merging the joint pdf with itself:
Environment
Which environment were you using when you encountered the problem?
$ python3 -m platform Linux-5.19.0-35-generic-x86_64-with-glibc2.35 $ python3 -c "import pypdf;print(pypdf.__version__)" 3.10.0Code + PDF
This is a minimal, complete example that shows the issue:
Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests!
Traceback
This is the complete Traceback I see:
tmp.pdf