ImportAnnotationFromXfdf fails on empty elements

I am using the Aspose.Examples.CSharp solution, using version 10.5.1.0 of Aspose.PDF for .NET
I am running the ImportAnnotations.cs example.

I have found that the AnnotationEditor.ImportAnnotationsFromXfdf() fails when the XFDF XML contains a single tag empty element a.k.a. a self-closing tag, unless it happens to be the last annotation element in the annots collection.

I have attached several .xml files, labeled as working or failing. The uploader would not allow me to attach .xfdf files, so I had to change them to .xml files. I have also attached the .cs file from the examples solution in .txt format.

When the importing fails, I get a System.ApplicationException, where the error message is "{"Unknown XFDF element 'freetext'"}". The unknown xfdf element is whatever annotation element comes after the single tag empty element. If I change the single tag empty element to a double tag empty element, it works again.

To summarize:

only works if it's the last element in < annots >...
unless you change it to < line ... >

Thanks!

Hi Sam,


Thanks for contacting support.

Can you please share the sample/input PDF form which you are using so that we can test the scenario in our environment. We are sorry for this inconvenience.

I am using the ImportAnnotations.pdf that is included in the Aspose.Pdf.Examples.CSharp solution.

I have attached it to this reply.

Thanks!

Hi Sam,


Thanks for sharing the details.

I have tested the scenario and I am able to
notice the same problem. For the sake of correction, I have logged this problem
as
PDFNEWNET-39469 in our issue tracking system. We will
further look into the details of this problem and will keep you updated on the
status of correction. Please be patient and spare us little time. We are sorry
for this inconvenience.