i am generating an SSRS report into PDF dynamically and i need to show it in the PDF viewer.
In the Examples, it is shown that we need to store the PDF in the Application
and give the document source in the xaml or in .cs file.
I want to give the PDF url directly .. can you show me how to do that..
So i store the empty pdf file in my Application. I override the empty file with the dynamically generated PDF file.
Since the function is executed Async.. the old empty file is binded to the Pdfviewer (since the new file is still generating...)
Here is the code..
string baseUrl = "http://localserver/ReportServer?&rs:Command=Render&rs:ClearSession=true&rs:Format=PDF"; (its not correct url)
string path = @"C:\Users\grcha\Desktop\06-07\Example\l";
DomainContext pdc = new DomainContext();
pdc.SaveReportToPdf(baseUrl, path, (operation =>
pdfViewer.DocumentSource = new PdfDocumentSource(new System.Uri("/Example;component/Report1.pdf",
System.UriKind.Relative)); var ids = operation.Value; }), null);
--- Method in Domain Service
public void SaveReportToPdf(String baseUrl, String path)
var req = (HttpWebRequest)WebRequest.Create(baseUrl);
req.Credentials = CredentialCache.DefaultCredentials;
req.Method = "GET";
string reportPath = Path.Combine(path, "Report1.pdf");
var objResponse = req.GetResponse();
var fs = new FileStream(reportPath, FileMode.Create);
var stream = objResponse.GetResponseStream();
var buf = new byte;
if (stream != null)
var len = stream.Read(buf, 0, 1024);
while (len > 0)
fs.Write(buf, 0, len);
len = stream.Read(buf, 0, 1024);
if (stream != null) stream.Close();
can you show me how to do using streams or any other way...