This is a migrated thread and some comments may be shown as answers.

outofmemory exception with pdf or xls export

8 Answers 586 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandro Cavazzoni
Top achievements
Rank 1
Sandro Cavazzoni asked on 24 May 2010, 10:48 AM
Hi to all,
i started to test telerik report system. I made a really simple report (a simple grid from an sql table of about 100 rows... without images). I added webreportviewer to my project and connected it to my report. When i test my application i can see the report preview, i can export it in RTF or CSV but i cannot export it in PDF or XLS due an out of memory exception.
I'm using it on windows azure development enviroment. My system is an updated windows 7 64 bit with 4GB of ram and visual studio 2010 pro.

This is the exception stack trace
[OutOfMemoryException: Memoria insufficiente.] 
   System.Drawing.Graphics.FromHdcInternal(IntPtr hdc) +203 
   System.Drawing.Font.ToLogFont(Object logFont) +184 
   System.Drawing.Font.ToHfont() +166 
   Telerik.Reporting.Pdf.Fonts.TrueType.FontReader.GetFontData(Font font, Boolean& isTTC) +390 
   Telerik.Reporting.Pdf.Fonts.TrueType.TrueTypeDescriptor..ctor(Font gdiFont) +736 
   Telerik.Reporting.Pdf.Fonts.TrueType.TrueTypeDescriptor..ctor(PdfFont font) +84 
   Telerik.Reporting.Pdf.PdfFontTable.GetDescriptor(PdfFont font) +399 
   Telerik.Reporting.Pdf.PdfFontDictionary..ctor(PdfDocument document, PdfFont drawingFont) +198 
   Telerik.Reporting.Pdf.PdfFontType0Dictionary..ctor(PdfDocument document, PdfFont font) +73 
   Telerik.Reporting.Pdf.PdfFontTable.GetFont(PdfFont font) +315 
   Telerik.Reporting.Pdf.PdfPageDictionary.GetFontName(PdfFont font, PdfFontDictionary& fontDictionary) +132 
   Telerik.Reporting.Pdf.Rendering.PdfRenderer.GetFontName(PdfFont font, PdfFontDictionary& fontDictionary) +101 
   Telerik.Reporting.Pdf.Rendering.PdfRendererGraphicsState.Update(PdfFont font, Brush brush, Int32 renderMode) +179 
   Telerik.Reporting.Pdf.Rendering.PdfRenderer.Update(PdfFont pdfFont, Brush brush, Int32 renderMode) +184 
   Telerik.Reporting.Pdf.Rendering.PdfRenderer.DrawString(String text, PdfFont font, Brush brush, RectangleF rect, Boolean rightToLeft) +404 
   Telerik.Reporting.Pdf.Drawing.PdfGraphics.DrawString(String s, Font font, Brush brush, RectangleF rect, StringFormat format) +303 
   Telerik.Reporting.ImageRendering.CanvasPdf.DrawStringMultiline(String s, Font font, Brush brush, RectangleF rect, StringFormat format) +954 
   Telerik.Reporting.ImageRendering.TextBox.Render() +846 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderToPage(RectangleRF clip, RoundedFloat parentLeft, RoundedFloat parentTop, RoundedFloat parentReservedTop, RoundedFloat parentReservedBottom, RoundedFloat parentReservedLeft, RoundedFloat parentReservedRight) +2858 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderChildren(RectangleRF clip) +473 
   Telerik.Reporting.ImageRendering.RenderingElement.RenderToPage(RectangleRF clip, RoundedFloat parentLeft, RoundedFloat parentTop, RoundedFloat parentReservedTop, RoundedFloat parentReservedBottom, RoundedFloat parentReservedLeft, RoundedFloat parentReservedRight) +3025 
   Telerik.Reporting.ImageRendering.CompositionBase.RenderPageSection(PageArea pageArea, RenderingElement pageSection, Single height) +713 
   Telerik.Reporting.ImageRendering.CompositionBase.ApplyPageSections() +405 
   Telerik.Reporting.ImageRendering.CompositionBase.SendPhysicalPages(Boolean force) +142 
   Telerik.Reporting.ImageRendering.CompositionBase.End() +145 
   Telerik.Reporting.ImageRendering.CompositionPdf.End() +262 
   Telerik.Reporting.ImageRendering.CompositionBase.Dispose(Boolean disposing) +94 
   Telerik.Reporting.ImageRendering.CompositionPdf.Dispose(Boolean disposing) +91 
   Telerik.Reporting.ImageRendering.CompositionBase.System.IDisposable.Dispose() +53 
   Telerik.Reporting.ImageRendering.ImageRendererBase.RenderReport(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +557 
   Telerik.Reporting.ImageRendering.ImageRendererBase.Telerik.Reporting.Processing.IRenderingExtension.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +96 
   Telerik.Reporting.Processing.ReportProcessor.Render(IList`1 reports, ExtensionInfo extensionInfo, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback) +2090 
   Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback) +814 
   Telerik.ReportViewer.WebForms.ServerReport.Render(HttpResponse response, String format, Int32 pageIndex) +1390 
   Telerik.ReportViewer.WebForms.ReportExportOperation.PerformOperation(NameValueCollection urlQuery, HttpContext context) +180 
   Telerik.ReportViewer.WebForms.HttpHandler.ProcessRequest(HttpContext context) +501 
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1182 
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +230 
 

Some suggestion about to solve (or workaround) the problem?

Thanks

Sandro

8 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 25 May 2010, 02:40 PM
Hello Sandro Cavazzoni,

Currently there are several known issues of the Azure platform itself when hosting a reporting product, namely export to PDF and Excel are not working. Take a look at the following MSDN thread where MS acknowledges the problem. 

You can check out the Medium Trust Support article to find out more about the limitations and requirements for deploying an ASP.NET application containing Telerik Reporting on a web host that imposes modified Trust permission level.

Best wishes,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Sandro Cavazzoni
Top achievements
Rank 1
answered on 26 May 2010, 11:26 AM
Thank you for your reply.
In a future the problems will be solved? Today i'm valuating if buy only asp.net radcontrols or the complete telerik premium collection. My decision depend from telerik reporting. If the issues will be solved in a future i can buy and use telerik reporting in my project. Instead i need to search for another solution.

Best regards

Sandro Cavazzoni
0
Steve
Telerik team
answered on 26 May 2010, 05:10 PM
Hi Sandro,

We don't want to disappoint you, but most likely you would not be able to find a reporting product that supports export to PDF and XLS in medium trust. The problem is that both both formats rely on permissions that are available in Full Trust and there is not much we can do to change that.

Greetings,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Kevin
Top achievements
Rank 2
answered on 21 Jul 2010, 09:29 PM
At least as of the June release, there shouldn't be a trust issue anymore since Azure supports full trust.  While running under Full Trust, I get the same error.

Here is the code I use to set up the export:

ReportProcessor processor = new ReportProcessor();
CMS.Reports.CurrentMember report = new CurrentMember();
 
processor.RenderReport("PDF", report, null);

I get the same OutOfMemory exception trying to render the report.
0
Steve
Telerik team
answered on 27 Jul 2010, 10:06 AM
Hi Kevin,

As my colleague pointed out in the first reply, this is a problem of Windows Azure. Here is a link to a more recent thread where Microsoft acknowledges the problem with Report Viewers and export to PDF: LocalReport viewing (rdlc) report in Windows Azure gives Out of Memory Exception.

All the best,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tolga Tari
Top achievements
Rank 1
answered on 19 Oct 2010, 10:20 AM
hi telerik,

we are getting same error.
we are not using azure services, we only using telerik report in our asp.net application.
sample code;

Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", this.ReportViewer1.Report, null);  
This error continues permanently after first occurrance. But it is uncertain to know when will occurr first time..
And another bad news, after first occurrance, any reports pdf export does not work.. All of throws "Out of memory" exception..

Web application run under full trust level.
Operating system is windows server 2008 r2 and server has 64 GB ram.
IIS configured without memory limit or time limit.
We are using telerik reporting Q2 2010 and also included service pack for Q2 2010

So we must solve this error as soon as possible.
We need some suggestion or workaround to solve the problem..
Thank you..
0
Deva
Top achievements
Rank 1
answered on 26 Jul 2011, 08:08 PM
We are able using q2 2011 and the prior 2 version to export to pdf in azure... we do run into issues when our reports exceed 100 pages, even though we have set all the web config buffer settings to int32.Max in our bindings / readerquota, and added the httpruntime executiontimeout, and maxrequestlength to system.web and added a datacontractserializer maxItemsInObjectGraph to Int32.max... but below a 100 pages they seem to export just fine.  Our client is silverlight, and our ReportServer.svc is hosted in azure. (as is our client web site though the xap gets pulled down locally and run.)

-Deva
0
Steve
Telerik team
answered on 27 Jul 2011, 09:40 AM
Hi guys,

Indeed exporting to both PDF and Excel is working correctly now. What you should have installed: @Deva: Please use this code in the MainPage.xaml.cs:

Copy Code
public partial class MainPage : UserControl, IReportServiceClientFactory
{
    public MainPage()
    {
        InitializeComponent();
        this.ReportViewer1.ReportServiceClientFactory = this;
    }
    ReportServiceClient IReportServiceClientFactory.Create(System.Uri remoteAddress)
    {
        // if the service is used with SSL use this overload !
        var binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
        {
            MaxBufferSize = int.MaxValue, 
            MaxReceivedMessageSize = int.MaxValue,
           
ReceiveTimeout = new TimeSpan(0, 15, 0),
            SendTimeout = new TimeSpan(0, 15, 0)
        };
        var endpointAddress = new EndpointAddress(remoteAddress);
        return new ReportServiceClient(binding, endpointAddress);
    }
}


Greetings,
Steve
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
General Discussions
Asked by
Sandro Cavazzoni
Top achievements
Rank 1
Answers by
Peter
Telerik team
Sandro Cavazzoni
Top achievements
Rank 1
Steve
Telerik team
Kevin
Top achievements
Rank 2
Tolga Tari
Top achievements
Rank 1
Deva
Top achievements
Rank 1
Share this question
or