Open SQL PDF Report in PDF not Report Viewer


I am trying to open a SQL Report in a pdf instead of the report view when i click on a link on my site, which is written in C#.  You can see below the code that I have that says open the url I give it in another window.  Currently when I click the link the report will open in the SQL report wizard, but I want it to go stright to pdf like in the second image.  is there something that i need to put in the URL for this to happen or what?
Response.Write("<script>'" + url + "');</script>");

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

why not

Response.Write("<a href=('" + url + "')> PDF Version</a>");
Megan BrooksSQL Server ConsultantCommented:
Is the URL you are opening a Report Server URL? If so, you can add the query parameter rs:Format=PDF to request that the report be rendered in PDF format. See the example below. When I go to this (intranet) URL, it brings up the dialog shown in your second image.

I haven't actually tried this but another approach might be to use the ServerReport.Render method of the ReportViewer control. It can render a report in PDF format and return it as a Stream that you can use however you need to.


Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DB_FuryAuthor Commented:
Thats exactly what i was looking for!! thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.