none
Show PDF document C # SILVERLIGHT RRS feed

  • Question

  • Hi every one, my english is not so good, but i will try to explain me, the question is that I want to know the correct way to open or download pdf documents that are in a folder. I have the following code where I pass as a parameter the name of the folder (transfer.IdTransfer) in which PDFS documents are lit

    System.Windows.Browser.HtmlElement myFrame = System.Windows.Browser.HtmlPage.Document.GetElementById("_sl_historyFrame");
                if (myFrame != null)
                {
                    myFrame.SetStyleAttribute("width", "1024");
                    myFrame.SetStyleAttribute("height", "768");
                    Uri uri = new Uri(@"\\192.168.1.216\UploadFileMobilePDF\" + transfer.IdTransfer + "\\127fa8fa-7b03-4ce0-bfef-206c589ef0cf.pdf");
                    string path = uri.AbsoluteUri.ToString();
                    myFrame.SetAttribute("src", path);
                    myFrame.SetStyleAttribute("left", "0");
                    myFrame.SetStyleAttribute("top", "50");
                    myFrame.SetStyleAttribute("visibility", "visible");
                }

    executing that code works for me without problems, but what I try to do is open the PDFS that are in that folder without specifying the name of the PDF in the path

    Since I use SILVERLIGHT in the project

    I will be grateful for any proposal



    Edgar Rojas H.

    Monday, September 9, 2019 1:24 PM

All replies

  • Silverlight apps run inside the browser's protective sandbox.  They cannot access the client file systems.

    Now, if 192.168.1.216 had a web server, then you could write a short web page to send out an index, which your Silverlight app could then parse.  But if 192.168.1.216 is just a file server, then it cannot be done.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, September 9, 2019 6:27 PM
  • Silverlight apps run inside the browser's protective sandbox.  They cannot access the client file systems.

    Now, if 192.168.1.216 had a web server, then you could write a short web page to send out an index, which your Silverlight app could then parse.  But if 192.168.1.216 is just a file server, then it cannot be done.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    So if it is a file server i can not show the pdfs?

    Edgar Rojas H.

    Monday, September 9, 2019 9:20 PM
  • Hi Eddy RH, 

    Thank you for posting here.

    According to your description, your issue is more related to Silverlight. Therefore, it will be more appropriate to ask your question in Silverlight Forums.

    The C# forum is for C# related question, we discuss and ask the C# programming language, IDE, libraries, samples and tools here.

    Thank you for your understanding.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, September 10, 2019 2:19 AM
  • Just use DirectoryInfo.GetFiles() to find filename of all PDF files in that directory, the show them in a listbox, and swtich the URL of the frame when user select a different file.
    Tuesday, September 10, 2019 4:38 AM
  • The Silverlight forum you quoted is locked. Noone can ask question there.
    Tuesday, September 10, 2019 4:40 AM
  • Not through the client's file system.  IF the file server can be accessed from the web server, then as Cheong00 suggested, you can put code on your web server to return those files, then have your Silverlight code convert the file name to an HTTP request for your web server.

    The key point is that the web server can access files, but code running in the browser cannot.


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Tuesday, September 10, 2019 6:04 AM