asp.net c# crystal report export to PDF memory full

ぐ巨炮叔叔 提交于 2020-05-01 06:39:10

问题


I am building a report using Crystal Reports and VS2010: ASP.NET/C# which is fairly big (6 pages using OLE Objects), so I am not sure if that would be the cause or solution to this problem, but I need to know either how to fix this or an alternative. All other reports that I built using OLE Objects in the same manner still export just fine.

The code I am using is:

protected void exportPDF_btn_Click(object sender, EventArgs e)
{
    ReportDocument repDoc = getReportDocument(); //regathers the report

    Response.Buffer = false;

    Response.ClearContent();
    Response.ClearHeaders();

    try
    {
        repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "filename");
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
        ex = null;
    }
    finally
    {
        Response.End();
    }
}

The problem is that I keep getting an error that says:

Memory Full, Failed to export the report, Not enough memory for operation

Other solutions I have tried:

  • Resetting IIS
  • Restarting Server
  • Installing CutePDF as suggested: Crystal Report 2008 - Memory Full
  • Changing 3rd param from true to false resulting in this line of code:

    repDoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "filename");

  • Using ExportToDisk as opposed to ExportToHttpResponse, resulting in this code:

    repDoc.ExportToDisk(ExportFormatType.PortableDocFormat, @"Z:\KFauver\test\file.pdf");

This report is one of the last items that I need to complete to finally be able to push to beta test. However, I am now officially lost as to how to export this to PDF (or anything for that matter). Any help is appreciated! Whether it be a fix or an alternative, ill try it. Thanks in advance.


回答1:


Apparently, having 6 instances of a word doc OLE object on a report will cause it to need too much memory. I did not realize this. My fix was to take screenshots of every page and paste the images into the report. Seems to work just fine that way.




回答2:


I had this problem near two weeks ago and my project due to this error was pending. After trying any action like below . Install few PDF printer Update my Crystal report version Change the default Printer and …

At the end my problem has been solved by checked of No printer(optimize for screen display) in crystal report and save the report. Now it works good Thanks



来源:https://stackoverflow.com/questions/20105739/asp-net-c-sharp-crystal-report-export-to-pdf-memory-full

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!