Parser Constructor (String, LoadOptions)
Initializes a new instance of the Parser class with LoadOptions.

Namespace: GroupDocs.Parser
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 20.8.0
Syntax
public Parser(
	string filePath,
	LoadOptions loadOptions
)

Parameters

filePath
Type: SystemString
The path to the file.
loadOptions
Type: GroupDocs.Parser.OptionsLoadOptions
The options to open the file.
Remarks
Examples

The document password is passed by LoadOptions class:

C#
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");
}
See Also