Reporting Services Corrupted PDF files
Hi, I use the command line program rs.exe to create some exports in pdf format from a Reporting Services Server 2005. I sometimes have problems to open the export of one specific report. Acrobat Reader shows error 109, file corruption. I used the option -l 0 to ensure that no timeout occurs. I used the option -e mgmt2000 because I could not find the syntax for the new namespace in SSRS 2005. The other reports use the completely same settings and everythings works perfectly. This is the batch: rs -i D:\SSRS\Scripts\run_MyReport.rss -s http://myserver/reportserver -l 0 -e mgmt2000 -t -bAnd this is the input file (run_MyReport.rss): ' Export report to pdf format to the specified path under filePath and to the file which is specified under fileNDim format as string = "PDF"Dim filePath as String = "D:\exports\Reports2Send\"Dim fileN as String = "MyReport"'Dim Datum as String = CString(Date)Dim fileName as String = filePath + fileN + ".pdf"Dim reportPath as String = "/MyFolder/MyReport"Public Sub Main() ' Prepare Render arguments Dim historyID as string = Nothing Dim deviceInfo as string = Nothing Dim showHide as string = Nothing Dim results() as Byte Dim encoding as string Dim mimeType as string = "application/pdf" Dim warnings() AS Warning = Nothing Dim reportHistoryParameters() As ParameterValue = Nothing Dim streamIDs() as string = Nothing 'Windows Credentials were send to Reporting server service rs.Credentials = System.Net.CredentialCache.DefaultCredentials ' Report Parameters Dim parameters(0) As ParameterValue results = rs.Render(reportPath, format, _ Nothing, Nothing, Nothing, _ Nothing, Nothing, encoding, mimeType, _ reportHistoryParameters, warnings, streamIDs) ' Open a file stream and write out the report Dim stream As FileStream = File.OpenWrite(fileName) stream.Write(results, 0, results.Length) stream.Close()End Sub'End of script Did anyone experience similar problems?Best regards, Stefoon
August 17th, 2007 5:51am

Hi, Do you need to recover your file? If so, maybe you can try a tool called Advanced PDF Repair. I have used it to repair many corrupt PDF files on my damaged disks successfully. Its homepage is http://www.datanumen.com/apdfr/ Hope this will help. Alan
Free Windows Admin Tool Kit Click here and download it now
April 8th, 2008 4:29am

Hi Stefoon, Do you find a solution ? I have a similar problem when exporting reporting services reports to pdf format.The pdf files are created by a c# console application.The application is executed in a SSIS package with a Execute Process Task .Sometimes the pdf files are not correctly generated : error 109, file corruption.The files are not empty. A part of the report is generated.The reports are also exported in Excel format and there are no problems. This is a part of the code :(the application uses the reporting services web service) Code Snippet string ext = null; ReportService2005.ReportingService rs = new ReportService2005.ReportingService(); ReportExecution2005.ReportExecutionService rsExec = new ReportExecution2005.ReportExecutionService(); rs.Credentials = System.Net.CredentialCache.DefaultCredentials; rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials; rs.Url = "http://" + Server + "/ReportServer/ReportService2005.asmx"; rsExec.Url = "http://" + Server + "/ReportServer/ReportExecution2005.asmx"; string historyID = null; string deviceInfo = null; Byte[] results; string encoding = String.Empty; string mimeType = String.Empty; string extension = String.Empty; ReportExecution2005.Warning[] warnings = null; string[] streamIDs = null; string fileName = Folder + @"\" + _report + ext; string _reportName = _report; string _historyID = null; bool _forRendering = false; ReportService2005.ParameterValue[] _values = null; ReportService2005.DataSourceCredentials[] _credentials = null; ReportService2005.ReportParameter[] _parameters = null; try { ReportExecution2005.ExecutionInfo ei = rsExec.LoadReport("/" +_reportpath + "/" + _reportName, historyID); results = rsExec.Render("PDF", deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs); using (FileStream stream = File.OpenWrite(fileName + ".pdf")) { stream.Write(results, 0, results.Length); } } catch (Exception ex) { Console.WriteLine(ex.Message); } reporting services version : 2005 SP2 9.0.3200platform : windows server 2003 enterprise SP2pdf viewer : acrobat reader v.7 Best regards, SQLeer
April 29th, 2008 4:21am

Hi Stefoon, Hi Gurvan I have a similar problem when exporting reporting services reports to pdf format.Do you find a solution ?Best regards
Free Windows Admin Tool Kit Click here and download it now
March 16th, 2009 6:22am

Hi, If you are having problems with corrupted/ incomplete PDF exports then please describe the report that is having the export problem and post the error message from the Report Server logs. Best regards, Andre
March 16th, 2009 12:11pm

Has anyone figured this out? If so what the solution?Thanks, Bob
Free Windows Admin Tool Kit Click here and download it now
April 21st, 2009 10:25pm

You may want to check my link... If you are still having this issue, may be a problem with a HotFix/Setting on your server. http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/6f750009-cd8e-4329-9d82-809c3c26795dMariano - Lucon Technologies www.lucontech.com
March 14th, 2012 11:03am

Was this ever resolved? We are facing the same issue...
Free Windows Admin Tool Kit Click here and download it now
May 24th, 2012 11:04am

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

Other recent topics Other recent topics