Question : How to open document in Flash Drive from Silverlight Application in drive

I am evaluating the feasibility of preparing a self contained demo in a flash drive using Silverlight. One of the problems to solve is to be able to display a document present in the same directory as the Siverlight Application (using the HTMLWindow.Navigate).

The question is, is this possible, and if it is, what would be the uri to use assuming that the document is named Document.pdf?

I am using VB.Net.

Answer : How to open document in Flash Drive from Silverlight Application in drive

If it's not important to display pdf within Silverlight app, you can try to open new window that would point to your pdf file (that isnt restrict file access policy).

You can access current document Uri using: HtmlPage.Document.DocumentUri

string pdfFileUri = HtmlPage.Document.DocumentUri.ToString().Replace("MySLTestPage.html", "FILES\myPDF.pdf");

then just HtmlPage.Window.Eval("window.open('" + pdfFileUri + "')");

or System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(pdfFileUri, UriKind.Absolute), "_newWindow", "toolbar=0,menubar=0,resizable=1");

that would open new browser window with your pdf file as content and won't apply to Silverlight restrictions on reading file system files w\o user action request.


As another solution >If you need to display PDF inside same window<, we can do a little trick:

Using IFrame within Silverlight Application (check http://www.davidezordan.net/blog/?p=700 and RadHTMLPlaceHolder control <- one i preffer more) you can place pdf uri as src for iFrame and show it in there. It's not apply to policy restrictions as well, coz iFrame is kind of separate window.
Random Solutions  
 
programming4us programming4us