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

Free Support Forum - aspose.com

Aspose.Pdf.Generator.Pdf.Save(Stream stream) System.NullReferenceException

Having issues with Aspose.Pdf.Generator.Pdf.Save(Stream stream) throwing a System.NullReferenceException: Object reference not set to an instance of an object.

It appears to happen frequently, especially when there is heavy traffic on our servers. (load on IIS).

We cannot reproduce this error locally on our development desktops. (Does not happen locally.)

We are on aspose.pdf version 9.5.

Any help is greatly appreciated.

System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.

at š.[1](String , Pdf , Section , Text ) at.š.[1](Pdf , Section , Text , Cell , HeaderFooter , ‹ ) at.š.[1](Pdf , Section , Table , Cell , Text , HeaderFooter , [1] , ‹ ) at.œ.[1](Pdf , Section , HeaderFooter , Table , Row , Cell , Text , [1] , ‹ , Boolean ) at..[1](Pdf , Section , Table , Row , Cell , [1] , ‹ ) at

.Ž.[1](Pdf doc, Section
currentPart, HeaderFooter hf, Table table, [1] assignInfo, ‹ useType, Boolean isFirst, &
breakTableNextPart) at…[1](Pdf
, Section , Table , Row , Cell , [1]
, ‹ ) at.Ž.[1](Pdf , Section ,
Table , Row , [1]
, ‹ ) at.˜.[1](Pdf doc, Section
currentPart, HeaderFooter hf, Table table, [1] assignInfo, ‹ useType, Boolean isFirst, &
breakTableNextPart) at..[1](Pdf , Section , [1]
) at..[1](Pdf
) at…[1](
, Pdf ) at
Aspose.Pdf.Generator.Pdf.Save(Stream stream)

<o:p></o:p>



<o:p></o:p>

Hi Suresh,


Thanks for your inquiry. I am afraid it is quite difficult to suggest you anyting without replicating the issue at our end. However, Could you please double check your license implementation? It is recommended to place the license initialization code in some static method which is executed once at the start of application. You may place the license initialization code in Main(), Page_Load() or any method which is executed at the start of application. There is no need to re-initialize the license in multi-threaded environment when a new thread is created. The license is valid until the main application thread is running.

Please note you are using a quite older version of Aspose.Pdf for .NET. Please use latest version of Aspose.Pdf for .NET as we have made number of fixes and improvements in later versions.

Furthermore, it is recommended to use new generator(Aspose.Pdf) as it is more improved and efficient than old generator(Aspose.Pdf.Generator). Old generator will be obsolete in near future, so we are not fixing issues or making improvements in old generator anymore.


We are sorry for the inconvenience caused.


Best Regards,