Get annotation author

Product: PDFNet

Product Version: 9.3.0

Hi there,

I’m trying to export PDF comments.
I can get the annotation contents but how can I get the author of the annotation?

            for (PageIterator itr = pdfDocument.getPageIterator(); itr.hasNext();) {

                Page page = itr.next();
                if (page.getNumAnnots() > 0) {
                    for (int i = 0; i < page.getNumAnnots(); ++i) {
                        Annot annot = page.getAnnot(i);

                        // Check if valid
                        if ((!annot.isValid()) || ((annot.getType() == 1) || (annot.getType() == 15))) {
                            continue;
                        }

                        String annotContent= annot.getContents();
                        Date annotDate = annot.getDate();

Best regards,
Rothnak

Hello,

You can get the author of an annotation by modifying your loop as shown:

//... loop
Annot annot = page.getAnnot(i);
Markup CurrentMarkup = new Markup(annot);
if (annot.isMarkup())
{
  string author = CurrentMarkup.getTitle(); // get current annotation author
}

https://docs.apryse.com/api/PDFTronSDK/java/com/pdftron/pdf/Annot.html#isMarkup()

The method getTitle() will return the string value for the author who created the annotation.

Thanks,

Marcus Andra
Senior Technical Support Engineer