Parser Constructor (Stream, LoadOptions, ParserSettings)
Initializes a new instance of the Parser class with LoadOptions and ParserSettings.

Namespace: GroupDocs.Parser
Assembly: GroupDocs.Parser (in GroupDocs.Parser.dll) Version: 20.8.0
Syntax
public Parser(
	Stream document,
	LoadOptions loadOptions,
	ParserSettings parserSettings
)

Parameters

document
Type: System.IOStream
The source input stream.
loadOptions
Type: GroupDocs.Parser.OptionsLoadOptions
The options to open the file.
parserSettings
Type: GroupDocs.Parser.OptionsParserSettings
The parser settings which are used to customize data extraction.
Remarks
Examples

The following example shows how to receive the information via ILogger interface:

C#
// try
{
    // Create an instance of Logger class
    Logger logger = new Logger();
    // Create an instance of Parser class with the parser settings
    using (Parser parser = new Parser(stream, null, new ParserSettings(logger)))
    {
        // 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)
{
    ; // Ignore the exception
}

private class Logger : ILogger
{
    public void Error(string message, Exception exception)
    {
        // Print error message
        Console.WriteLine("Error: " + message);
    }
    public void Trace(string message)
    {
        // Print event message
        Console.WriteLine("Event: " + message);
    }
    public void Warning(string message)
    {
        // Print warning message
        Console.WriteLine("Warning: " + message);
    }
}
See Also