New to Telerik UI for .NET MAUI? Start a free 30-day trial

Password-Protected PDF Document

To allow the users to open password-protected documents in the PDF Viewer, you must handle the SourcePasswordNeeded event.

  • SourcePasswordNeeded—Occurs when a user password is needed to load the document in the PDF Viewer. The SourcePasswordNeeded event handler receives two parameters:
    • The sender argument, which is of type object, but can be cast to the RadPdfViewer type.
    • A PasswordNeededEventArgs object, which provides the Password property used to supply the user password.

The following example demonstrates how to use the SourcePasswordNeeded event:

<telerik:RadPdfViewer x:Name="pdfViewer" 
                      SourcePasswordNeeded="pdfViewer_SourcePasswordNeeded" />

The next code snippet represents the event handler:

private void pdfViewer_SourcePasswordNeeded(object sender, Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PasswordNeededEventArgs e)
{
    e.Password = "my_user_password_here";
}

See Also

In this article