#3294·pypdf

PdfObject.indirect_reference is not available

Author: stefan6419846Created May 22, 2025Updated Aug 7, 2026
Labelsis-buggenericneeds-discussion

Creating a simple PdfObject or DictionaryObject and accessing its indirect_reference attribute fails, although it is part of the protocol/PdfObject class.

Initially discovered while looking at #3293.

Environment

Which environment were you using when you encountered the problem?

bash
$ python -m platform
Linux-6.4.0-150600.23.47-default-x86_64-with-glibc2.38

$ python -c "import pypdf;print(pypdf._debug_versions)"
pypdf==5.5.0, crypt_provider=('cryptography', '44.0.0'), PIL=11.1.0

Code + PDF

This is a minimal, complete example that shows the issue:

python
from pypdf.generic import DictionaryObject, PdfObject

print(PdfObject().indirect_reference)
print(DictionaryObject().indirect_reference)

Traceback

This is the complete traceback I see:

Traceback (most recent call last):
  File "/home/stefan/tmp/scratches/scratch_6.py", line 3, in <module>
    print(PdfObject().indirect_reference)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PdfObject' object has no attribute 'indirect_reference'