# Loading Documents

## Content



To open an existing PDF file you can use the [LoadDocument](/componentone/api/wpf/online-pdfviewer/dotnet-framework-api/C1.WPF.PdfViewer.4.6.2/C1.WPF.PdfViewer.C1PdfViewer.LoadDocument.html) method by passing a stream to the file. To open a file selected by the user, complete the following code:

```vbnet
Dim openPicker As New FileOpenPicker()
openPicker.FileTypeFilter.Add(".pdf")
Dim file As StorageFile = Await openPicker.PickSingleFileAsync()
If file IsNot Nothing Then
    Dim stream As Stream = Await file.OpenStreamForReadAsync()
    pdfViewer.LoadDocument(stream)
End If
```

```csharp
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.FileTypeFilter.Add(".pdf");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null) 
{
Stream stream = await file.OpenStreamForReadAsync();
    pdfViewer.LoadDocument(stream);
}
```

## See Also

[Loading Encrypted Files](/componentone/docs/wpf/online-pdfviewer/overview/PdfViewerFeatures/LoadingDocuments/LoadingEncryptedFiles)

**Task-Based Help**

[Loading Documents from the Web](/componentone/docs/wpf/online-pdfviewer/overview/Task-BasedHelp/LoadingDocumentsfromtheWeb)

[Opening Potentially Protected Files](/componentone/docs/wpf/online-pdfviewer/overview/Task-BasedHelp/OpeningPotentiallyProtectedFiles)