I am generating an ssrs report in my Silverlight application and I need to convert the ssrs report to RadPDFViewer control
(telerik silverlight).
So I am saving the pdf file in the project folder using WCF.
Now i need to read the file again and bind it to Pdfviewer.
Saving happens asynchronously. How should I wait untill the file is saved and then read from the folder?
Also, can you please show me how to read the PDF as a Memory stream.
I run the following code unsuccessfully.
public byte[] ReturnPdf(string requestUrl) {
HttpWebRequest req = null; var buf = new byte[1024];
try
{
req = (HttpWebRequest)WebRequest.Create(requestUrl);
req.Credentials = CredentialCache.DefaultCredentials;
req.Method = "GET"; var objResponse = req.GetResponse();
var stream = objResponse.GetResponseStream();
if (stream != null){BinaryReader br = new BinaryReader(stream);
buf = br.ReadBytes(1024);
} if
(stream != null) stream.Close();
}
catch Exception e){}return buf;
}
private void button2_Click(object sender, EventArgs e)
{
string baseUrl = "http://abc/ReportServer&rs:Command=Render&rs:ClearSession=true&rs:Format=PDF";
const string nullString = ":isnull=true";
byte[] o = ReturnPdf(baseUrl);
byte[] bytes = new byte[1024];
Stream s = new MemoryStream(bytes);
}