NullReferenceException in AnnotationRenderer

Hi,

I'm getting a NullReferenceException when using the pdfviewer.GetAnnotationComments() method.

On further investigation I've located the problem within the AnnotationRenderer class in the internal ShapeAnnotation LoadPolylineAnnotation(PdfLoadedPolyLineAnnotation polylineAnnot, float pageHeight, float pageWidth, int pageRotation, PdfLoadedFreeTextAnnotation shapeFreeText) method.

Code:

if (polylineAnnot.Dictionary.ContainsKey("BE"))
{
PdfDictionary pdfDictionary = polylineAnnot.Dictionary["BE"] as PdfDictionary;
if (pdfDictionary != null && (pdfDictionary["S"] as PdfName).Value == "C")


The if-statement throws a NullReferenceException since the pdfDictionary is NOT null, but has no entries.

How do I fix this?


3 Replies

VS Vasugi Sivajothi Syncfusion Team November 30, 2021 03:13 PM UTC

Hi Domenico, 
 
Thank you for contacting Syncfusion support. 
 
We suspect that the reported issue is due to annotation is not getting properly while loading the PDF document. This issue seems to the document specific. Could you please confirm whether you have faced an issue only with the particular document? If yes, please share the PDF document in which you have reproduced the issue. And please share the console error details and network tab response details while loading the PDF document. This will be helpful to investigate further and provide the solution at the earliest. 
 
Regards, 
Vasugi. 



DT Domenico Thöni November 30, 2021 03:16 PM UTC

This issue arises with many documents with annotations. Not just one.


Where to can I send a example document?

I don't want to post it online in a public forum.



VS Vasugi Sivajothi Syncfusion Team December 2, 2021 06:11 AM UTC

Hi Domenico, 
 
Thank you for the update. We have created a ticket under your account. Please share the PDF document in that ticket. This will be helpful to investigate further and provide the solution at the earliest. 
 
Regards, 
Vasugi. 


Loader.
Up arrow icon