- Home
- Forum
- Xamarin.Forms
- Null reference exception on PdfViewerControl.SaveDocument
Null reference exception on PdfViewerControl.SaveDocument
Hello,
I'm sometimes getting a null reference exception when calling pdfViewerControl.SaveDocument(). When I exit of the pdf view, I want to save any mark-ups that I've added. So, in the button handler I make a call to pdfViewerControl.SaveDocument(). It seems I'm only having the issue on Android. Sometimes, it works fine, and other times I get a System.NullReferenceException with a source of "SyncFusion.Pdf.Portable."
Here's the StackTrace:
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.Save (Syncfusion.Pdf.IO.IPdfWriter writer) [0x00021] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.Primitives.PdfDictionary.SaveItems (Syncfusion.Pdf.IO.IPdfWriter writer) [0x00286] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.Primitives.PdfDictionary.Save (Syncfusion.Pdf.IO.IPdfWriter writer, System.Boolean bRaiseEvent) [0x00047] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.Primitives.PdfStream.Save (Syncfusion.Pdf.IO.IPdfWriter writer) [0x001c8] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.IO.PdfCrossTable.DoSaveObject (Syncfusion.Pdf.Primitives.IPdfPrimitive obj, Syncfusion.Pdf.Primitives.PdfReference reference, Syncfusion.Pdf.IO.PdfWriter writer) [0x000ae] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.IO.PdfCrossTable.SaveIndirectObject (Syncfusion.Pdf.Primitives.IPdfPrimitive obj, Syncfusion.Pdf.IO.PdfWriter writer) [0x001e0] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.IO.PdfCrossTable.SaveObjects (Syncfusion.Pdf.IO.PdfWriter writer) [0x0015f] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.IO.PdfCrossTable.Save (Syncfusion.Pdf.IO.PdfWriter writer) [0x0017d] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.Parsing.PdfLoadedDocument.AppendDocument (Syncfusion.Pdf.IO.PdfWriter writer) [0x0001b] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.Pdf.Parsing.PdfLoadedDocument.Save (System.IO.Stream stream) [0x00114] in <96ea103c151d4af3b40ad4e62cdd8e90>:0
at Syncfusion.SfPdfViewer.XForms.Droid.ScrollViewEx.SaveDocument (System.Boolean flattenFormFields) [0x01847] in <f5d188b682d844b5a33023a93f840691>:0
at Syncfusion.SfPdfViewer.XForms.Droid.PdfDependencyServices.SaveDocument (System.Object nativeObject, System.Boolean flattenForm) [0x00015] in <f5d188b682d844b5a33023a93f840691>:0
at Syncfusion.SfPdfViewer.XForms.SfPdfViewer.SaveDocument () [0x0000c] in <284950a800324ed4875696ace3e0d1ee>:0
at ManualViewer.Views.PDFPhoneView.<Handle_BackButtonClicked>b__22_0 () [0x00000] in /Users/krikoz/Developer/ManualViewer/ManualViewer/Views/PDFPhoneView.xaml.cs:273
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
at System.Threading.Tasks.Task.Execute () [0x00000] in <d4a23bbd2f544c30a48c44dd622ce09f>:0
And the TargetSite is {Void Save(Syncfusion.Pdf.IO.IPdfWriter)}
Please let me know if you need any more information.
Thanks,
Kristen
SIGN IN To post a reply.
1 Reply
SS
Sathish Sivakumar
Syncfusion Team
March 6, 2019 09:25 AM UTC
Hi Kristen,
Greetings from Syncfusion.
We tried to reproduce reported issue “NullReferenceException thrown sometime when calling the SaveDocument method in SfPdfViewer in Xamarin.Forms(Android)” in our side, but it works as expected. Please find the sample from the below link with which we tried to reproduce the issue.
Kindly share the following details to analyze further and provide you with prompt solution:
1. Share the simple sample or modify the above sample to reproduce the issue.
2. Xamarin.Forms version
3. PDF Viewer version
4. Android device or emulator details.
Regards,
Sathish
Sathish
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
ZC Zach Carls
- Mar 5, 2019 09:42 PM UTC
- Mar 6, 2019 09:25 AM UTC