Form data is not coming in my pdf is always coming empty. can you help me to resolve this

Original sample PDF file (1).pdf (317 KB)

code snippet:
Document doc = new Document(“C:\OCMobile\a.pdf”);
PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(doc);
com.aspose.pdf.facades.Form pdfForm = new com.aspose.pdf.facades.Form(doc);
String[] fieldNames = pdfForm.getFieldNames();

// This fieldnames is coming empty always but form field is there so any solution on this

@SUBHAROOP

Please read the following article to achieve your requirement. Hope this helps you.
Extract Annotations from PDF

//code snippet

String in=“C:\OCMobile\a.pdf”;
Document doc = new Document(in);
PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(doc);
Form pdfForm = new Form(doc);
annotationEditor.bindPdf(doc);
int[] annotTypes = new int[]{AnnotationType.Text, AnnotationType.Highlight};
List annotList = annotationEditor.extractAnnotations(1, 2 , annotTypes);

I have used this below code and getting exception from extractAnnotations method can you tell me what change I need to do provide me the final snippet to retrieve the annotation .
Use this pdf file:
noPHI sample PDF file (1).pdf (277.2 KB)

@SUBHAROOP

We have tested the scenario using the latest version of Aspose.PDF for Java 22.9 and have not faced any exception. Please upgrade to the latest version of Aspose.PDF for Java 22.9 to avoid this issue.