GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / PdfShowDialogForPassword Property
Example





In This Topic
PdfShowDialogForPassword Property (GdViewer)
In This Topic
Enables or disables the option that allows you to utilize your own dialog box requesting a password if the PDF document to display is protected.

If this property is set to true, the GdViewer control prompts the user automatically with the dialog box to insert the password if the PDF to display is protected. Changing this property to false will force the control to use your own dialog box. Then you will have to catch the PdfPasswordRequest event to display your dialog box for entering the password.

Syntax
'Declaration
 
Public Property PdfShowDialogForPassword As Boolean
public bool PdfShowDialogForPassword {get; set;}
public read-write property PdfShowDialogForPassword: Boolean; 
public function get,set PdfShowDialogForPassword : boolean
public: __property bool get_PdfShowDialogForPassword();
public: __property void set_PdfShowDialogForPassword( 
   bool value
);
public:
property bool PdfShowDialogForPassword {
   bool get();
   void set (    bool value);
}

Property Value

The default value is true.
Remarks
This property is only meaningful for PDF documents.

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

Example
How to utilize this property in 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 allow the viewer control to use the event.
GdViewer1.PdfShowDialogForPassword = False
            
'Add the event.
AddHandler GdViewer1.PdfPasswordRequest, AddressOf GdViewer1_PdfPasswordRequest
            
'Define the event.
Sub GdViewer1_PdfPasswordRequest(ByRef Password As String)
    '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 allow the viewer control to use the 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