GdPicture.NET.14
GdPicture14.WPF Namespace / GdViewer Class / PdfPasswordRequest Event
Example





In This Topic
PdfPasswordRequest Event (GdViewer)
In This Topic
This event is raised if a password is required to decrypt the loaded PDF document for display. The event is explicitly raised when the PdfShowDialogForPassword property is set to false.

The event makes use of bubble routing strategy. Please check the corresponded GdViewer.PdfPasswordRequestEventArgs for given parameters.

You are allowed to prompt the user with your own dialog box for entering the password for protected PDF documents using this event.

Syntax
'Declaration
 
Public Event PdfPasswordRequest As GdViewer.PdfPasswordRequestHandler
public event GdViewer.PdfPasswordRequestHandler PdfPasswordRequest
public event PdfPasswordRequest: GdViewer.PdfPasswordRequestHandler; 
In JScript, you can handle the events defined by another class, but you cannot define your own.
public: __event GdViewer.PdfPasswordRequestHandler* PdfPasswordRequest
public:
event GdViewer.PdfPasswordRequestHandler^ PdfPasswordRequest
Event Data

The event handler receives an argument of type GdViewer.PdfPasswordRequestEventArgs containing data related to this event. The following GdViewer.PdfPasswordRequestEventArgs properties provide information specific to this event.

PropertyDescription
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
The password required to decrypt the loaded PDF document.  
(Inherited from System.Windows.RoutedEventArgs)
(Inherited from System.Windows.RoutedEventArgs)
Remarks
This event is only meaningful for PDF documents and it is solely raised only if the PdfShowDialogForPassword property is set to false.

Be aware that without entering the correct password the required PDF document will not display.

Example
How to utilize this event in your GdViewer control.
'We assume that the GdViewer1 control has been properly integrated
'and the PdfPasswordRequest event has been properly added.
            
'Define the event.
Sub GdViewer1_PdfPasswordRequest(ByVal sender As Object, ByVal e As GdPicture14.WPF.GdViewer.PdfPasswordRequestEventArgs)
    'Display your own dialog box to allow users to insert the correct password.
End Sub
//We assume that the GdViewer1 control has been properly integrated
//and the PdfPasswordRequest event has been properly added.
            
//Define the event.
void GdViewer1_PdfPasswordRequest(object sender, GdPicture14.WPF.GdViewer.PdfPasswordRequestEventArgs e)
{
    //Display your own dialog box to allow users to insert the correct password.
}
See Also