New to Telerik UI for .NET MAUIStart a free 30-day trial

Password-Protected PDF Document

Updated over 6 months ago

To allow the users to open password-protected documents in the .NET MAUI 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:

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

The next code snippet represents the event handler:

C#
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
See Also
Not finding the help you need?
Contact Support