PdfObject.indirect_reference is not available
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Start by locating the PdfObject and DictionaryObject definitions in pypdf.generic and compare them with the protocol/PdfObject declaration. Reproduce the issue with the minimal Python example, then verify that both objects expose indirect_reference without raising AttributeError.
Written by the indexing model from the issue text.
Description
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?
$ 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:
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'
- Dominant language
- Python
- Stars
- 10.2k
- Forks
- 1.6k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 81
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from py-pdf/pypdf
-
nf-testing
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
whitespace workflow-text-extraction
Difficulty 4/5 3-5 days Newbie friendliness 72/100
-
is-bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
-
workflow-text-extraction
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
is-maintenance
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100