We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error When calling PdfDocument.Save()

Thread ID:

Created:

Updated:

Platform:

Replies:

148666 Oct 29,2019 05:59 PM UTC May 7,2020 05:54 AM UTC WinForms 2
loading
Tags: PDF
Aaron Knipe
Asked On October 29, 2019 05:59 PM UTC

When saving a newly created pdf document I am getting a null reference exception.

Stack Trace:
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.get_Index()
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.ObtainObject()
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.get_Object()
at Syncfusion.Pdf.Primitives.PdfReferenceHolder.Save(IPdfWriter writer)
at Syncfusion.Pdf.Primitives.PdfDictionary.SaveItems(IPdfWriter writer)
at Syncfusion.Pdf.Primitives.PdfDictionary.Save(IPdfWriter writer, Boolean bRaiseEvent)
at Syncfusion.Pdf.Primitives.PdfDictionary.Save(IPdfWriter writer)
at Syncfusion.Pdf.Primitives.PdfDictionary.SaveItems(IPdfWriter writer)
at Syncfusion.Pdf.Primitives.PdfDictionary.Save(IPdfWriter writer, Boolean bRaiseEvent)
at Syncfusion.Pdf.Primitives.PdfDictionary.Save(IPdfWriter writer)
at Syncfusion.Pdf.Primitives.PdfDictionary.SaveItems(IPdfWriter writer)
at Syncfusion.Pdf.Primitives.PdfDictionary.Save(IPdfWriter writer, Boolean bRaiseEvent)
at Syncfusion.Pdf.Primitives.PdfDictionary.Save(IPdfWriter writer)
at Syncfusion.Pdf.IO.PdfArchiveStream.SaveObject(IPdfPrimitive obj, PdfReference reference)
at Syncfusion.Pdf.IO.PdfCrossTable.DoArchiveObject(IPdfPrimitive obj, PdfReference reference, PdfWriter writer)
at Syncfusion.Pdf.IO.PdfCrossTable.SaveIndirectObject(IPdfPrimitive obj, PdfWriter writer)
at Syncfusion.Pdf.IO.PdfCrossTable.SaveObjects(PdfWriter writer)
at Syncfusion.Pdf.IO.PdfCrossTable.Save(PdfWriter writer)
at Syncfusion.Pdf.PdfDocument.Save(Stream stream)
at Syncfusion.Pdf.PdfDocumentBase.Save(String filename)
at .BusinessObjects.PDFMerge.FilesMerge(Int32 workOrderNumber, Int32 district, Int32 school, DateTime testBeginDate, Boolean IsPartial) in C:\\Users\\\\source\\repos\\RemoteDownload\\\\BusinessObjects\\PDFMerge.cs:line 78
at ..PDFMerge() in C:\\Users\\\\source\\repos\\RemoteDownload\\\\.cs:line 58
at ..Execute(TestScoreFile testScoreFile, BubbleFormWorkOrder workOrder) in C:\\Users\\\\source\\repos\\RemoteDownload\\\\.cs:line 35
at .Program.Main(String[] args) in C:\\Users\\\\source\\repos\\RemoteDownload\\\\Program.cs:line 31"

Sowmiya Loganathan [Syncfusion]
Replied On October 30, 2019 09:51 AM UTC

Hi Aaron, 

Thank you for contacting Syncfusion support.  

We have checked the mentioned issue with the provided stack trace. We suspect that this issue occurs due to disabling of “EnableMemoryOptimization” property. In older version by default we have perform merge function by clone each and every objects from existing PDF document and dispose it. But effective from product version 17.1.0.32, we did not process the above. The existing PDF document will dispose only after saving of merged PDF document. However you can overcome this by set true to “EnableMemoryOptimization” of PDF document. 

Please refer the below KB link for more details, 

Please try the above solution in your end and let us know if it solves the issue. If not please share us the PDF documents which you have used in your end. It will helpful for us to provide the precise solution on this.  

Regards, 
Sowmiya Loganathan 



Aaron Knipe
Replied On October 30, 2019 01:22 PM UTC

This solves my problem thank you!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon