Open SQL PDF Report in PDF not Report Viewer

Hello,

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>window.open('" + url + "');</script>");

Open in new window

img1.JPG
img2.JPG
LVL 1
DB_FuryAsked:
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.

rg20Commented:
why not

Response.Write("<a href=('" + url + "')> PDF Version</a>");
0
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.

http://web2/CPCARS10/Pages/ReportViewer.aspx?%2fCPCA+Shared%2fAdmin%2fAdmin+-+Website+Accounts&rs:Command=Render&rs:Format=PDF

Open in new window

0

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
0
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
C#

From novice to tech pro — start learning today.