Is it possible to get the author of a free text annotation using iText?
I have the TYPE and CONTENTS, but can see noway to get the author
Is it possible to get the author of a free text annotation using iText?
I have the TYPE and CONTENTS, but can see noway to get the author
Please consult ISO-32000-1 table 170 "Additional entries specific to markup annotations". It defines a key named /T
that is described as an optional text string that shall be displayed in the title bar of the annotation's pop-up window when open and active. This entry shall identify the user who added the annotation.
KenS is correct in the sense that the value you seek is not available for every type of annotations, but if the author is present, you'll find it in the /T
entry.
So when you have this in Adobe Acrobat:
You'll find this inside the PDF:
You already have the /Contents
and /Type
entry, now you should also look for the /T
entry. If it is missing, the author of the annotation can not be retrieved.
These are some examples on how to get specific keys from an annotation:
I'm adding these links only for the sake of completeness, I think you already know the concept:
PdfDictionary annotDict = annots.getAsDict(i);
PdfName author = annotDict.getAsString(PdfName.T);
If author
is null
, the author can not be retrieved.
While you can specify extra keys in a dictionary, which will usually be ignored, there is no 'Author' key in an annotation or FreeText annotation in the specification.
So you can't get the author of a FreeText annotation, because its not normally part of an annotation.