New to Telerik UI for .NET MAUI? Start 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. TheSourcePasswordNeededevent handler receives two parameters:- The sender argument, which is of type
object, but can be cast to theRadPdfViewertype. - A
PasswordNeededEventArgsobject, which provides thePasswordproperty used to supply the user password.
- The sender argument, which is of type
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";
}