We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exception when importing XFDF file with Document.ImportAnnotationsFromXfdf( string filename )

We use Aspose.Pdf .NET Version 19.9.0. When importing a XFDF file with PdfAnnotationEditor.ImportAnnotationsFromXfdf( string filename ), we get an NULL exception:

at Aspose.Pdf.Resources.get_Fonts()
   at Aspose.Pdf.Annotations.Annotation.get_Appearance()
   at Aspose.Pdf.Annotations.Annotation.#=zhGrh6gHzwQjB(String #=zia7mUhc=, Annotation #=zGiJa$no=)
   at Aspose.Pdf.Annotations.HighlightAnnotation.#=zhGrh6gHzwQjB(String #=zia7mUhc=, Annotation #=zGiJa$no=)
   at Aspose.Pdf.Annotations.Annotation.#=zUQ6dqD8=(Annotation #=zGiJa$no=)
   at Aspose.Pdf.Annotations.Annotation.#=zvBqXLnexvHVU_GVZKb0iLqg=()
   at Aspose.Pdf.Annotations.HighlightAnnotation..ctor(Page page, Rectangle rect)
   at Aspose.Pdf.Annotations.XfdfReader.ReadAnnotations(Stream stream, Document document)
   at Aspose.Pdf.Facades.PdfAnnotationEditor.ImportAnnotationFromXfdf(Stream xfdfStream, AnnotationType[] annotType)

I have attached a ZIP file with a PDF file and the XFDF file. Please try it. You should get the same exception. The XFDF contains a Highlight/Marking Annotation for page 2 of the PDF.

aspose.zip (284.0 KB)

Here you find a simple sample project (.net 4.7.1 console app):

Download-Link for zip (Dropbox)

Is this a bug in the library?



Thank you for contacting support.

We are afraid that conversion of XML to FDF may not be supported by the API at the moment so the annotations can not be imported. We have logged a feature request with ID PDFNET-47031 in our issue management system for further investigations and resolution. We will let you know as soon as any update will be available in this regard.


okay, but for what reason do those methods exist for importing and exporting XFDF content? Even in your developer guide you have several examples showing the usage of those methods:

Sample in your Documentation

So, is it not supported at all or are those methods buggy and you will fix this?

It is very important for us. The handling of XFDF for annotations is one of the main features we need!


The counterpart method PdfAnnotationEditor.ExportAnnotationsXfdf() for exporting annotations in XFDF format is working without any problem.
So it should be a classic bug in the import mechanism.



Thank you for elaborating further.

We have further investigated your data and have been able to reproduce the exception. You are right as it appears to be an issue with import mechanism. A ticket with ID PDFNET-47055 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

Hi there,

any news here? Can you give me an estimate for when the fix will be available? We had to STOP our work in this regard and are waiting for the fix…



Please note that the issue has been logged under free support model and will be investigated on first come first serve basis. Therefore, it may take some months to resolve. As soon as we have some definite updates regarding ticket resolution, we will let you know.

Furthermore, we also offer paid support model where issues are resolved on urgent basis and have priority over the issues logged under free support model. You may check our Paid Support options for your reference.

Hi there,

any news here? We are still waiting for a fix… (since more than 5 months now) :frowning:

Thanks and regards


Regretfully the issue is not yet resolved due to other high priority implementations to the API. We have recorded your concerns however - and will surely inform you as soon as we have some certain news on issue rectification. Please spare us some time.

We are sorry for the inconvenience.