Expose the annotation name (/NM) and the subject (/Subj) - #21663
Open
gronke wants to merge 1 commit into
Open
Conversation
Both are in the file and neither reaches `getAnnotations()`, so a caller that reads a PDF's own annotations cannot see what the document calls them or what they say they are about.
`/NM` is the annotation name: "a text string uniquely identifying it among all the annotations on its page" (ISO 32000-1, Table 164).
It is not `data.id`, which is the object reference — a caller correlating annotations with anything outside the file needs the name the document gives them, and that is also the name viewers key their own records off.
It is read on `Annotation`, where the common dictionary lives, as `data.annotationName`.
`/Subj` is "text representing a short description of the subject being addressed by the annotation" (Table 170), a markup-annotation entry.
It is read as `data.subjectObj` in the same `{ str, dir }` shape as `titleObj` and `contentsObj`, since it is a text string and can be right-to-left.
A group member inherits it from the primary annotation, alongside the title, the contents and the dates it already inherits.
Both are read-only additions to the data object; nothing that consumes it changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two entries that are in every annotated PDF and reach no caller.
/NM- the annotation nameThis is not
data.id.data.idis the object reference ("819R"), which changes when a file is rewritten and says nothing about what the document calls the annotation./NMis the name the document itself gives it, and the name viewers key their own records off - Acrobat writes one on everything it creates.Anything correlating a PDF's annotations with state held outside the file needs it.
Without it a caller has to join on the object id, which breaks the moment the file is written again.
Read on
Annotation, where the common annotation dictionary is parsed, asdata.annotationName./Subj- what the annotation is aboutA markup-annotation entry, so it is read in
MarkupAnnotationasdata.subjectObj, in the same{ str, dir }shape astitleObjandcontentsObj- it is a text string and can be right-to-left.A group member inherits it from the primary annotation, alongside the title, contents and dates it already inherits.
Notes
Both are read-only additions to the data object. Nothing that consumes it changes, and no display behaviour changes -
subjectObjis deliberately not wired into the popup, which would be a separate decision.Four unit tests: each field present and absent, plus the group-inheritance test extended to assert the inherited subject.
See https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf