Asked by:
Reporting Services Corrupted PDF files

Question
-
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 -b
And 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 fileN
Dim 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,
StefoonFriday, August 17, 2007 9:51 AM
All replies
-
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 Snippetstring 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.3200
platform : windows server 2003 enterprise SP2
pdf viewer : acrobat reader v.7Best regards,
SQLeer
Tuesday, April 29, 2008 8:21 AM -
Hi Stefoon, Hi Gurvan
I have a similar problem when exporting reporting services reports to pdf format.
Do you find a solution ?
Best regardsMonday, March 16, 2009 10:22 AM -
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
Monday, March 16, 2009 4:11 PMAnswerer -
Has anyone figured this out? If so what the solution?
Thanks, BobWednesday, April 22, 2009 2:25 AM -
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.
Mariano - Lucon Technologies www.lucontech.com
Wednesday, March 14, 2012 3:03 PM -
Was this ever resolved? We are facing the same issue...Thursday, May 24, 2012 2:58 PM