Error saving report to PDF
SSRS 2008 R2 I have a report with a number of subscriptions saving the report in pdf to a file share. One of the subscriptions continuisly failes. When I render it manualy and save it to PDF: it seems to work, but when I open the pdf file I get an error "the file is damaged". Saving the report to excel works fine. This is what I find in the error logging: reportrendering!WindowsService_15!147c!11/30/2010-17:18:12:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: , Microsoft.ReportingServices.ReportProcessing.UnhandledReportRenderingException: An error occurred during rendering of the report. ---> Microsoft.ReportingServices.OnDemandReportRendering.ReportRenderingException: An error occurred during rendering of the report. ---> System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.WriteStartItemToStream(RPLWriter rplWriter, PageContext pageContext) at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.SubReport.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) at Microsoft.ReportingServices.Rendering.HPBProcessing.ReportSection.NextPage(RPLWriter rplWriter, Int32 pageNumber, Int32 totalPages, Double top, Double availableHeight, ReportSection nextSection, Boolean isFirstSectionOnPage) at Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 totalPages) at Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport) at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream) at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream) --- End of inner exception stack trace --- at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream) at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory metaDataChunkFactory, IChunkFactory yukonCompiledDefinition) --- End of inner exception stack trace ---; Any help is appreciated Regards Antoon
November 30th, 2010 1:55pm

Hi Antoon, The root cause for the issue is "System.ArgumentException: An item with the same key has already been added". From the exception, we can know it happens when trying to add duplicate key to a Dictionary(System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add). After analysising the detailed exception, the error occurred when the render extenstion tried to add a subreport: at Microsoft.ReportingServices.Rendering.HPBProcessing.SubReport.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) And then tried to add Row to a page content: at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.AddToPageContent(ScalableList`1 columnInfo, Int32& colsOnPage, Boolean isLTR, Boolean pinnedToParentCell, RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) Finally, added a textbox to a page: at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.AddToPage(RPLWriter rplWriter, PageContext pageContext, Double pageLeft, Double pageTop, Double pageRight, Double pageBottom, RepeatState repeatState) So, please review all textboxes in the subreport, and check if there is invalid expression in the textboxes. Alternative, could you please send us the report definition? If we can reproduce the issue, it will help us to troubleshoot the issue. You can send the file to sqltnsp AT microsoft dot com. Thanks, Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
December 1st, 2010 1:09am

Jin, Thanks for the reply. I've searched for errors (by searching for the strings "error" or "invalid") but haven't found any. I can save the report as excel and mhtlm so it's something specific with regards to pdf. I've send the report definitions to the email adress
December 2nd, 2010 6:45am

We are also having this issue. There are several of our reports that can not be deployed to PDF without an damsge file error. I have checked each report to make sure there are no invalid expressions and there are none and there are also no sub-reports attached to these reports. The reports that are having issues were developed and converted correctly. All of these reports have been rendering in PDF without any issues. This started happening when we upgrade to 2008R2.Sherrill
Free Windows Admin Tool Kit Click here and download it now
December 3rd, 2010 3:39pm

We are also having this issue. The reports actually run fine, and MOST of the time they generate the PDF file correctly from the subscription. However, today I found that a few of the reports (different parameters in the subscription) seem to have trouble writing the PDF file. We have other reports that are much larger and use subscriptions but do not have the issue. I am wondering if perhaps there is a character or a font issue. I really can find no explanation for this. We have not applied any of the cumulative updates. Has anyone else? Teresa
December 3rd, 2010 4:49pm

Hi Antoon, I have reviewed the report definitions. However, I am not able to reproduce, as I don't have the sample data. Just based on the report definitions, could you please try to remove the subreport(the third one) to check if the issue is fixed? Thanks, Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
December 7th, 2010 10:41pm

Jin, I've removed the third subreport but I still get the same error Regards Antoon
December 8th, 2010 4:51am

Hi Antoon, This is confirmed to be a known issue, and will be fixed. If it is big business impact, I would suggest you contacting Microsoft Customer Service Support to require a private hotfix. Thanks, Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
December 8th, 2010 10:57pm

Thank you, We have a work around by saving it to mhtml Regards Antoon
December 9th, 2010 3:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics