Back to Devexpress

PdfViewer.PasswordRequested Event

windowsforms-devexpress-dot-xtrapdfviewer-dot-pdfviewer-60204d6a.md

latest3.2 KB
Original Source

PdfViewer.PasswordRequested Event

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

Namespace : DevExpress.XtraPdfViewer

Assembly : DevExpress.XtraPdfViewer.v25.2.dll

NuGet Package : DevExpress.Win.PdfViewer

Declaration

csharp
public event PdfPasswordRequestedEventHandler PasswordRequested
vb
Public Event PasswordRequested As PdfPasswordRequestedEventHandler

Event Data

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

PropertyDescription
FileNameReturns the file name of a document that is requested to be opened in the PDF Viewer or PDF Document Processor.
FilePathReturns the path of the file requested to be opened in the PDF Viewer or PDF Document Processor.
PasswordObsolete. This property is now obsolete. Use the PdfPasswordRequestedEventArgs.PasswordString property instead.
PasswordRequestsCountReturns the current number of password request attempts.
PasswordStringSpecifies the security password to open a PDF file.

Remarks

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 ).

Example

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

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

private void pdfViewer1_PasswordRequested(object sender, PdfPasswordRequestedEventArgs e)
  {
    e.PasswordString = "password"
  }
vb
Imports System.Windows.Forms
Imports DevExpress.Pdf
' ...

Private Sub pdfViewer1_PasswordRequested(ByVal sender As Object, _
ByVal e As PdfPasswordRequestedEventArgs) Handles pdfViewer1.PasswordRequested
    e.PasswordString = "password"
End Sub

See Also

PdfViewer Class

PdfViewer Members

DevExpress.XtraPdfViewer Namespace