Example





In This Topic
GdPicture14 Namespace / GdViewer Class / PdfPasswordRequest Event

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.

Please check the corresponded GdViewer.PdfPasswordRequestEventHandler 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.PdfPasswordRequestEventHandler
public event GdViewer.PdfPasswordRequestEventHandler PdfPasswordRequest
public event PdfPasswordRequest: GdViewer.PdfPasswordRequestEventHandler; 
In JScript, you can handle the events defined by another class, but you cannot define your own.
public: __event GdViewer.PdfPasswordRequestEventHandler* PdfPasswordRequest
public:
event GdViewer.PdfPasswordRequestEventHandler^ PdfPasswordRequest
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 add this event to your GdViewer control.
'We assume that the GdViewer1 control has been properly integrated.
Friend WithEvents GdViewer1 As GdPicture14.GdViewer
            
'Set this property to False to properly use this event.
GdViewer1.PdfShowDialogForPassword = False
            
'Add the event.
AddHandler GdViewer1.PdfPasswordRequest, AddressOf GdViewer1_PdfPasswordRequest
            
'Define the event.
Sub GdViewer1_PdfPasswordRequest(ByRef Password As String) Handles GdViewer1.PdfPasswordRequest
    '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.
            
//Set this property to false to properly use this event.
GdViewer1.PdfShowDialogForPassword = false
            
//Add the event.
GdViewer1.PdfPasswordRequest += GdViewer1_PdfPasswordRequest;
            
//Define the event.
void GdViewer1_PdfPasswordRequest(ref string Password)
{
    //Display your own dialog box to allow users to insert the correct password.
}
See Also