Parser Constructor (String, LoadOptions) |
Namespace: GroupDocs.Parser
The document password is passed by LoadOptions class:
try { // Create an instance of Parser class with the password: using (Parser parser = new Parser(filePath, new LoadOptions(password))) { // Check if text extraction is supported if (!parser.Features.Text) { Console.WriteLine("Text extraction isn't supported."); return; } // Print the document text using (TextReader reader = parser.GetText()) { Console.WriteLine(reader.ReadToEnd()); } } } catch (InvalidPasswordException) { // Print the message if the password is incorrect or empty Console.WriteLine("Invalid password"); }