Skip to content

Resolve an annotation's /Subtype and /Contents when they are indirect objects - #125

Merged
0xabu merged 1 commit into
0xabu:mainfrom
RavSinghChandan:resolve-indirect-subtype-contents
Nov 8, 2026
Merged

0xabu merged 1 commit into
0xabu:mainfrom
RavSinghChandan:resolve-indirect-subtype-contents

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

A text annotation whose /Contents is an indirect object makes the whole run fail:

AttributeError: 'PDFObjRef' object has no attribute 'startswith'

and an indirect /Subtype stops at assert isinstance(subtype, PSLiteral). Both values may be indirect in a PDF, and _mkannotation() already resolves the other entries it reads (/C, /Rect, /QuadPoints, /T, /NM, the dates) with pdftypes.resolve1(). Now these two are resolved the same way.

Added tests/indirect-objects.pdf (a single text annotation with both values indirect, made with pypdf) and an IndirectObjects test; it fails on main. pytest tests.py, mypy ., flake8 and autopep8 --diff pass.

Used Claude (Opus) to help find and patch this; I reviewed and tested the change

@0xabu
0xabu merged commit a4b9c43 into 0xabu:main Nov 8, 2026
7 checks passed
@0xabu

0xabu commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants