To load a file from the Web you must first download it to your application using an asynchronous request such as WebClient or HttpWebRequest. Then you simply pass the resulting stream to the LoadDocument method. The following code snippet example uses a WebClient type of request:
Public Sub New()
InitializeComponent()
' load file from the Web
Dim client As New WebClient()
AddHandler client.OpenReadCompleted, AddressOf client_OpenReadCompleted
client.OpenReadAsync(New Uri("http://www.componentone.com/newimages/Products/Documentation/Silverlight.Maps.pdf", UriKind.Absolute))
End Sub
Private Sub client_OpenReadCompleted(sender As Object, e As OpenReadCompletedEventArgs)
C1PdfViewer1.LoadDocument(e.Result)
End Sub
•C#
public MainPage()
{
InitializeComponent();
// load file from the Web
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
client.OpenReadAsync(new Uri("http://www.componentone.com/newimages/Products/Documentation/Silverlight.Maps.pdf", UriKind.Absolute));
}
void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
c1PdfViewer1.LoadDocument(e.Result);
}
What You've Accomplished
In this example you've loaded PDF files into the C1PdfViewer control from the Web.