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. TheSourcePasswordNeeded
event handler receives two parameters:- The sender argument, which is of type
object
, but can be cast to theRadPdfViewer
type. - A
PasswordNeededEventArgs
object, which provides thePassword
property used to supply the user password.
- The sender argument, which is of type
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";
}