using iText I am able to get a list of annotations of a PDF. It seems that even replies are annotations themselves.
Extracting them, I look at the contents of the PdfDictionary using this
Set<PdfName> keys = annot.getKeys();
for (PdfName key : keys) {
System.out.println(key + "," + dictionary.get(key));
}
However, I cannot pinpoint which PdfName I need to use in order to identify replies belong to that certain annotation.
Please take a look at the official documentation, more specifically at the answer to the example How to add an "In Reply To" annotation?
In this answer, I explain how to add an "In reply to" to an existing annotation. Let's open the resulting PDF and let's take a look inside:
As you can see, the annotation with the content "Hello PDF" is stored in an object with number 1. It is an annotation in reply to (IRT
) the annotation with object number 2.
In answer to your question: you need to look at the key with value PdfName.IRT
and this will give you the object number of the annotation to which the current number is a reply.