Thursday, March 29, 2012

Exporting pdf from RS to a Win Form

I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
reports from RS in my Windows form. My questions are:
1) I've got the pdf from the Render-method in the RS Web Service, and tried
to display the pdf in a WebBrowser in my Windows Form using the
WebBrowser.DocumentStream property. But I don't know how set the content type
to application/pdf. I only get the binary displayed in the browser.
Suggestions?
2) If I access, from the same browser as in 1), a pdf through an URL, it
works fine. So, is if possible to retreive a report as a pdf through an URL
reference directly?
3) I could try to display the pdf some kind of other pdf container in my
winform. Does anyone know some nice tools to do this?
Regards,
Tomsi2) According to Books online for SQL Server CTP April 2005, it should be
possible to specify rs:Format=PDF as a parameter in the URL. But this doesn't
help me. It just seems to ignore the parameter... What could be wrong? Or
just simply doesn't the 2005 version support URL access directly?
"Tomsi" wrote:
> I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
> reports from RS in my Windows form. My questions are:
> 1) I've got the pdf from the Render-method in the RS Web Service, and tried
> to display the pdf in a WebBrowser in my Windows Form using the
> WebBrowser.DocumentStream property. But I don't know how set the content type
> to application/pdf. I only get the binary displayed in the browser.
> Suggestions?
> 2) If I access, from the same browser as in 1), a pdf through an URL, it
> works fine. So, is if possible to retreive a report as a pdf through an URL
> reference directly?
> 3) I could try to display the pdf some kind of other pdf container in my
> winform. Does anyone know some nice tools to do this?
> Regards,
> Tomsi|||I ran into this problem as well. I need to display pdf documents
within windows forms and I am trying to utilize the webbrowser control
but can't seem to set the contenttype to 'application/pdf'. Did you
ever find a solution?
Tomsi wrote:
> I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
> reports from RS in my Windows form. My questions are:
> 1) I've got the pdf from the Render-method in the RS Web Service, and tried
> to display the pdf in a WebBrowser in my Windows Form using the
> WebBrowser.DocumentStream property. But I don't know how set the content type
> to application/pdf. I only get the binary displayed in the browser.
> Suggestions?
> 2) If I access, from the same browser as in 1), a pdf through an URL, it
> works fine. So, is if possible to retreive a report as a pdf through an URL
> reference directly?
> 3) I could try to display the pdf some kind of other pdf container in my
> winform. Does anyone know some nice tools to do this?
> Regards,
> Tomsi|||1) As a temporary solution I save the pdf-stream to a file, and access the
file with the WebBrowser.Url-property:
--
string fileName = Path.GetTempFileName() + ".pdf";
FileStream fs = new FileStream(fileName, FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
_browserReport.Url = new Uri(fileName);
--
But I would like to know how to do this without saving to disk.
2) As far as I can read the SQL Server 2005 documentation, it should work to
get a pdf through URL access from Reporting Services by setting the attribute
"Format=PDF" in the URL. But I can't get it to work in the CTP april
2005-version.
3) Haven't tried this further out. I think Adobe sells some kind of SDK
which might help.
So my answer is that I'm still looking for a good solution.
Tomsi
"rich.beaver@.gmail.com" wrote:
> I ran into this problem as well. I need to display pdf documents
> within windows forms and I am trying to utilize the webbrowser control
> but can't seem to set the contenttype to 'application/pdf'. Did you
> ever find a solution?
> Tomsi wrote:
> > I'm using Reporting Services 2005 and .Net framework 2.0 and want to display
> > reports from RS in my Windows form. My questions are:
> >
> > 1) I've got the pdf from the Render-method in the RS Web Service, and tried
> > to display the pdf in a WebBrowser in my Windows Form using the
> > WebBrowser.DocumentStream property. But I don't know how set the content type
> > to application/pdf. I only get the binary displayed in the browser.
> > Suggestions?
> >
> > 2) If I access, from the same browser as in 1), a pdf through an URL, it
> > works fine. So, is if possible to retreive a report as a pdf through an URL
> > reference directly?
> >
> > 3) I could try to display the pdf some kind of other pdf container in my
> > winform. Does anyone know some nice tools to do this?
> >
> > Regards,
> > Tomsi
>sql

No comments:

Post a Comment