Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 How to Print a PDF report without opening pdf

Author  Topic 

bbasir
Yak Posting Veteran

76 Posts

Posted - 2008-04-14 : 13:37:12
I am using sql reporting service web service and need to print a file without opening it....

The code below lets me open the pdf file and from that one can print the same...

But, how can one print the file directly without opening the file... as I will have a loop where I will pass the 10 employee ids to the report and will be creating 10 reports, and I would like those 10 reports to directly go to printer..and not open up.

The code is as below that I am using right now that opens the file.

RSWebReference.ReportingService rs = new RSWebReference.ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

Byte[] result;

string encoding;
string mimetype;
ParameterValue[] parametersUsed;
Warning[] warnings;
string[] streamids;

result = rs.Render("/Reports/Sales","PDF",null,null,null,null,null,out encoding,out mimetype,out parametersUsed,out warnings,out streamids);

Response.ClearContent();
Response.AppendHeader("content-length", result.Length.ToString());
Response.ContentType = "application/pdf";
Response.BinaryWrite(result);
Response.Flush();
Response.Close();
   

- Advertisement -