How to Read PDF Annotations and It's properties

How to Read PDF Annotations and It’s properties

Want to read details of each Annotation of e_FreeText and e_Text.

I find functions like GetContents(). Same way how can I get below details of Markups into C# model object…

i. Annotation Identity Number
ii. Contents
iii. Subject
iv. User
v. AnnotationType
vi. PageNumber
vii. CreationDate
viii. ModificationDate

Tried below way, but didn’t get clear pattern functions on how I can get above details of single annotation…

for (var sdfitr = annot.GetSDFObj().GetDictIterator(); itr.HasNext(); itr.Next())
{

}

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

There are high level APIs for all those attributes, please see below.

i. Annotation Identity Number

Note in the PDF spec the ID is optional, and if present, only needs to be unique to the page itself. This code shows how to check and read the ID if present.

SDF.Obj obj = annot.GetUniqueID();
if(obj != null)
{
  string id = obj.GetAsPDFText();
}

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annot.html#pdftron_PDF_Annot_GetUniqueID

ii. Contents

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annot.html#pdftron_PDF_Annot_GetContents

iii. Subject

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annots.Markup.html#pdftron_PDF_Annots_Markup_GetSubject

iv. User

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annots.Markup.html#pdftron_PDF_Annots_Markup_GetTitle

Note according to the PDF standard that “This entry shall identify the user who added the annotation.

v. AnnotationType

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annot.html#pdftron_PDF_Annot_GetType

vi. PageNumber
See this post on how to reliably determine the page number of an annotation
Why do some annotations report they are on page zero?

vii. CreationDate

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annots.Markup.html#pdftron_PDF_Annots_Markup_GetCreationDates

viii. ModificationDate

https://www.pdftron.com/api/PDFTronSDK/dotnetcore/pdftron.PDF.Annot.html#pdftron_PDF_Annot_GetDate