Import XFDF for Annotations using Aspose.PDF for Java - java.lang.IllegalStateException: Required attribute is absent in XFDF stream

Hello,

We are receiving the error “java.lang.IllegalStateException: Required attribute is absent in XFDF stream” when processing PDF form with Xfdf associated. Please check attached form and xfdf files.LVL01-03 Excavation-Utility Permit.zip (1.5 MB)

Product vesrion - Aspose.PDF for Java, version 19.10

The method used to import annotations is PdfAnnotationEditor importAnnotationFromXfdf.

@natalie.burnett.mcde

We were able to reproduce the issue in our environment while using Aspose.PDF for Java 20.5 and following code snippet:

com.aspose.pdf.facades.PdfAnnotationEditor annotationEditor = new com.aspose.pdf.facades.PdfAnnotationEditor();
annotationEditor.bindPdf(dataDir + "LVL01-03 Excavation-Utility Permit  SMART.pdf");
annotationEditor.importAnnotationsFromXfdf(new FileInputStream(dataDir + "ExcavationPermit.xfdf"));
annotationEditor.save(dataDir + "output.20.5");

Therefore, we have logged an issue as PDFJAVA-39472 in our issue tracking system. We will further look into its details and keep you posted with its rectification status. Please be patient and spare us some time.

We are sorry for the inconvenience.

Upon further testing we have found that “QuadPoints” is an optional attribute that can be set
for an annotation to specify the region of an annotation. Others use the “rects” attribute which is a mandatory attribute to store the location of an annotation instead and thus does not set “QuadPoints”
attributes in the XFDF. It seems like the Aspose library relies solely on using “QuadPoints” attribute causing the missing attribute.

@natalie.burnett.mcde

Thanks for sharing the information.

We have recorded it along with the ticket and will surely investigate it from this perspective.

The issues you have found earlier (filed as PDFJAVA-39472) have been fixed in Aspose.PDF for Java 22.10.