PdfViewer.PasswordRequested Event

Occurs when requesting a security password to open a protected PDF file.

Namespace: DevExpress.XtraPdfViewer

Assembly: DevExpress.XtraPdfViewer.v20.1.dll


public event PdfPasswordRequestedEventHandler PasswordRequested
Public Event PasswordRequested As PdfPasswordRequestedEventHandler

Event Data

The PasswordRequested event's data class is PdfPasswordRequestedEventArgs. The following properties provide information specific to this event:

Property Description
FileName Returns the file name of a document that is requested to be opened in the PDF Viewer or PDF Document Processor.
FilePath Returns the path of the file requested to be opened in the PDF Viewer or PDF Document Processor.
Password Obsolete. This property is now obsolete. Use the PdfPasswordRequestedEventArgs.PasswordString property instead.
PasswordRequestsCount Returns the current number of password request attempts.
PasswordString Specifies the security password to open a PDF file.


To interrupt the password request process, the PdfPasswordRequestedEventArgs.PasswordString property value should be set to null.

To change the maximum number of allowed attempts to enter the PDF file's security password, use the PdfViewer.PasswordAttemptsLimit property (the default value is 1).


The following code illustrates the use of the PdfViewer.PasswordRequested event.

using System.Windows.Forms;
using DevExpress.Pdf;
// ...

private void pdfViewer1_PasswordRequested(object sender,
    PdfPasswordRequestedEventArgs e) {
    e.PasswordString = "password";    
See Also