PasswordRequired

EventHub.PasswordRequired event

Occurs when a document requires password for opening.

public event EventHandler<PasswordRequiredEventArgs> PasswordRequired;

Examples

The example demonstrates how to use the event.

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

// Creating an index
Index index = new Index(indexFolder);

// Subscribing to the event
index.Events.PasswordRequired += (sender, args) =>
{
    if (args.DocumentFullPath.EndsWith("ProtectedDocument.pdf", StringComparison.InvariantCultureIgnoreCase))
    {
        args.Password = "123456";
    }
};

// Indexing documents from the specified folder
index.Add(documentsFolder);

See Also