Friday, February 1, 2013

pdf docs in silverlight

pdf docs in silverlight

I have a requirement. I have to enable users to attach documents and that will get saved in the db in binary format.

Now the challenge is, I have to display the document list in the silverlight application and when user clicks on any of the link it should not ask for downloading the document instead it should open the document in the next tab. (the document could be pdf, png, excel, doc).

I have gone through multiple threads but all those thread ends on either third party tool or OOB. I cannot have OOB enabled.

I just want to check is there any way we can achieve this using silverlights inbuilt functions.

Answers & Comments...

Answer: 1

I think a combination of @Blam's comment of sending the proper mime type coupled with a Silverlight HyperlinkButton with the Target set for the new window would be your ticket. The XAML would look like this :

<HyperlinkButton Content="Name of PDF" Target="PDFWindow" NavigateUri="/DownloadPDF.aspx?id=BINDING OF UNIQUE ID" /> 

You'd add a page to your Silverlight project called DownloadPDF and it would take in one argument in the request variables; the unique ID of the PDF to grab from the database. DownloadPDF would change the mime type to "application/pdf" and then write the bytes from the SQL server to the response stream.

by : Joshhttp://stackoverflow.com/users/62623




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog