SfPdfViewer ExportAsImages Annotations are removed

Hello,
I have two problems
1st: SfPdfViewer ExportAsImages Annotations are removed
Steps to reproduce: 
1- Instantiate SfPdfViewer in view controller then load a pdf with LoadDocumentAsync from application's documents folder
2- Call ExportAsImages, extract UIImages and populate a collection view 
3- Add any annotation to a page of the loaded pdf, confirm visual feedback on screen, save changes to actual file, confirm annotation added to document by checking the actual file
4- Dismiss view controller, Unload and Dispose instantiated SfPdfViewer
5- Reopen the view controller and load same file, confirm annotation is visible in instantiated SfPdfViewer
6- Call ExportAsImages, extract UIImages and populate a collection view
7- Annotations are not visible

2: If the pdf(see attached zip for exact pdf) has already annotations(any kind) in it, ExportAsImages throwing exception. See below for trace:

"{System.NullReferenceException: Object reference not set to an instance of an object
  at Syncfusion.SfPdfViewer.iOS.ScrollViewEx.SaveDocument (Syncfusion.Pdf.Parsing.PdfLoadedDocument m_loadedDocument, System.Boolean flattenForm) [0x004e0] in <8beb620b22ff4a32a008b3e483192ac8>:0 
  at Syncfusion.SfPdfViewer.iOS.ScrollViewEx+<>c__DisplayClass288_0.<ExportAsImage>b__0 () [0x00000] in <8beb620b22ff4a32a008b3e483192ac8>:0 
  at Foundation.NSActionDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/Foundation/NSAction.cs:62 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr_bool(intptr,intptr,intptr,intptr,bool)
  at Foundation.NSObject.InvokeOnMainThread (System.Action action) [0x00007] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/Foundation/NSObject2.cs:605 
  at Syncfusion.SfPdfViewer.iOS.ScrollViewEx.ExportAsImage (System.Int32 index, System.Single scaleFactor) [0x0004a] in <8beb620b22ff4a32a008b3e483192ac8>:0 
  at Syncfusion.SfPdfViewer.iOS.SfPdfViewer.ExportAsImage (System.Int32 pageIndex, System.Single scaleFactor) [0x00000] in <8beb620b22ff4a32a008b3e483192ac8>:0 
  at Syncfusion.SfPdfViewer.iOS.SfPdfViewer.ExportAsImage (System.Int32 pageStartIndex, System.Int32 pageEndIndex, System.Single scaleFactor) [0x00013] in <8beb620b22ff4a32a008b3e483192ac8>:0 
  at Syncfusion.SfPdfViewer.iOS.SfPdfViewer.ExportAsImage (System.Int32 pageStartIndex, System.Int32 pageEndIndex) [0x00000] in <8beb620b22ff4a32a008b3e483192ac8>:0 
  at ***.iOS.Views.EditPdfViewController.SetPdfThumbnails () [0x00008] in ***.iOS/Controllers/EditPdfViewController.cs:393 }"


Attachment: annotationIn2ndPage.pdf_4f293cf7.zip

1 Reply

AV Ashokkumar Viswanathan Syncfusion Team August 19, 2020 10:01 AM UTC

Hi Onur, 
 
Thank you for contacting Syncfusion support, 
 
We were unable to reproduce the reported issue, “Annotations are not displayed when ExportAsImage is called” and ”Application throws null reference exception while calling ExportAsImage in particular PDF document  in our end. 
 
Please find the sample in the below link,   
   
Kindly share the below requested details to analyze more on this issue and assist you with the better solution     
·       Simple sample/ modify the above sample to reproduce the issue.    
·       PDF document. 
·       SfPdfViewer version. 
·       Xamarin Forms version. 
·       Replication procedure/video to reproduce the issue.   
 
Regards, 
Ashok Kumar Viswanathan. 


Loader.
Up arrow icon