1
votes

I am developing a C#/ASP.NET Web project at VS 2010 and it uses Crystal Reports (2008) version 12.3.0.601. Project calls the report and exports it as pdf. Anytime I change something at report design, "Memory Full" error shows up at when page is refreshed. Sometimes it does not give the error, but sometimes i try not to get the error for hours.

I have searched many sites related to the title but had no luck with a solution. Has anyone ever encountered such error before?

System.Runtime.InteropServices.COMException (0x80041004): Memory full. Failed to export the report. Not enough memory for operation.

Thanks for your help.

2
Any progress on that?tymtam
I have started over creating the reports, and do not add many things at once. That's my solution for now, and it is going pretty well.beebum

2 Answers

0
votes

For exporting to pdf I recommend you download some pdf printer ie. http://www.cutepdf.com/products/cutepdf/writer.asp

Then you can "print" the report to pdf no problems.

Hope it helps!

0
votes

I had a similar problem. On my report there are some texts and images. I have read that Crystal Report first converts the JPG, PNG, etc images to BMPs then it shows the report. And converting other image type to BMP consumes much memory. First I tried to convert JPG images to BMP images in my database but then my database became bigger and bigger. Finally I found the solution (thanks to this answer).

Instead of trying to export all pages to PDF file I splitted files, zipped them and download the zip file:

    Dim exportOpts As ExportOptions = New ExportOptions()
    Dim pdfRtfWordOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
    Dim destinationOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions()
    Dim intPageCount As Integer = crReportDocument.FormatEngine.GetLastPageNumber(New CrystalDecisions.Shared.ReportPageRequestContext)
    Dim pagecount As Integer
    pagecount = Int(intPageCount / 100) + 1
    Dim sonsayfa As Integer
    Dim ilksayfa As Integer
    Dim Anadosyaadi As String
    Dim foldername As String
    Dim foldernameMap As String
    Anadosyaadi = Now.ToString("yyyy-MM-dd-hh-mm-ss")
    foldername = "C:\inetpub\wwwroot\" + Anadosyaadi
    foldernameMap = "./" + Anadosyaadi

    If Not Directory.Exists(foldername) Then
        Directory.CreateDirectory(foldername)
    End If
    For li_count As Integer = 1 To pagecount
        ilksayfa = (li_count - 1) * 100 + 1
        pdfRtfWordOpts.FirstPageNumber = ilksayfa
        sonsayfa = li_count * 100
        If sonsayfa > intPageCount Then sonsayfa = intPageCount
        pdfRtfWordOpts.LastPageNumber = sonsayfa
        pdfRtfWordOpts.UsePageRange = True
        exportOpts.ExportFormatOptions = pdfRtfWordOpts
        exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat

        destinationOpts.DiskFileName = foldername + "\" + li_count.ToString + ".pdf"
        exportOpts.ExportDestinationOptions = destinationOpts
        exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
        crReportDocument.Export(exportOpts)
    Next
    Using zip As ZipFile = New ZipFile
        zip.AddDirectory(foldername)
        zip.Save(foldername + "\" + Anadosyaadi + ".zip")
    End Using
    Response.Redirect(foldernameMap + "/" + Anadosyaadi + ".zip")

PS1: I used Ionic.Zip to zip the files. You should add

Imports Ionic.Zip

on top of your source.

PS2: When I restart the server, without doing anything else, I can get 500 pages of PDF from page number 1 to 500. At this time, I think, Crystal Reports uses some memory. Then if I want to get the second 500 pages (I mean from page number 501 to 1000), I see memory full error. Then I can get 300 pages (from 501 to 800). Then another memory full problem and I can get from 801 to 900, etc. That's why I preferred to split 100 pages. Maybe you can change it to another number.