# Loading Encrypted Files

## Content



You can open encrypted files using the **C1PdfViewer** so long as you have the password that the file was encrypted with. To load password protected PDF documents use the [LoadDocument](/componentone/api/wpf/online-pdfviewer/dotnet-framework-api/C1.WPF.PdfViewer.4.6.2/C1.WPF.PdfViewer.C1PdfViewer.LoadDocument.html) method with the password as a parameter.

```vbnet
Dim password As String = "password"
Await pdfViewer.LoadDocument(stream, password)
```

```csharp
string password = "password";
await pdfViewer.LoadDocument(stream, password);
```

For a complete example that shows how to open encrypted and non-encrypted files together, see the topic [Opening Potentially Protected Files](/componentone/docs/wpf/online-pdfviewer/overview/Task-BasedHelp/OpeningPotentiallyProtectedFiles).

## See Also

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