Hello,
we have an asp.net 3.5 application that allows users to generate many charts and export them via pdf. This works fine for smaller pdfs (less than 100 pages), but when we do larger ones, we get random errors. some of the errors we have seen are:
--System.OutOfMemoryException
--Could not render the HTML string. Could not get image from html string. Try to set LoadHtmlConcurrencyLevel = 1..
--Clone error. Out of memory..
--Timeout waiting for conversion to finish.
--System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateImageData)
at System.Drawing.Image.FromStream(Stream stream)
If I run the big report multiple times, i usually get different exceptions. Sometimes I can get IIS to crash and I have to do a iisreset to get the application back up.
Here is the code we run. We create the PDF document with the charts (png images) and then export it out to a byte array and put it in a memorystream. We pass the memory stream to a function that rotates some of the images, etc and then call the doc.save method to export it.
Dim mainPageBytes() As Byte = PDF.GetBytes
Dim stream As New System.IO.MemoryStream(mainPageBytes)
Dim existingDoc As New PDFCreator.Document(stream)
Dim doc As PDFCreator.Document = GetDocument(mainPageBytes, GetChartingPageNumbers(PDF.ConversionSummary), pageOrientation, user, existingDoc)
doc.Save(response, True, Me.DocumentName)