ILogger interface is used to receive the information about errors, warnings and events which occur while data extraction. ILogger interface has the following members:
The following example shows how to receive the information via ILogger interface.
try{// Create an instance of Logger classLoggerlogger=newLogger();// Create an instance of Parser class with the parser settingsusing(Parserparser=newParser(Constants.SamplePassword,null,newParserSettings(logger))){// Check if text extraction is supportedif(!parser.Features.Text){Console.WriteLine("Text extraction isn't supported.");return;}// Print the document textusing(TextReaderreader=parser.GetText()){Console.WriteLine(reader.ReadToEnd());}}}catch(InvalidPasswordException){;// Ignore the exception}privateclassLogger:ILogger{publicvoidError(stringmessage,Exceptionexception){// Print error messageConsole.WriteLine("Error: "+message);}publicvoidTrace(stringmessage){// Print event messageConsole.WriteLine("Event: "+message);}publicvoidWarning(stringmessage){// Print warning messageConsole.WriteLine("Warning: "+message);}}
More resources
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples:
Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.