The set of the supported features depends on the document format. GroupDocs.Parser provides the functionality to check if feature supported for the document. Features property is used for this purposes.
The value that indicates whether form parsing is supported.
Here are the steps for check if feature is supported:
Instantiate Parser object for the initial document;
Call corresponding property of Feature property to check if the feature is supported.
The following example shows how to check if text extraction feature is supported:
// Create an instance of Parser classusing(Parserparser=newParser("doc.zip")){// Check if text extraction is supported for the documentif(!parser.Features.Text){Console.WriteLine("Text extraction isn't supported");return;}// Extract a text from the documentusing(TextReaderreader=parser.GetText()){Console.WriteLine(reader.ReadToEnd());}}
If the feature isn’t supported, the method returns null instead of the value. So if checking of Features properties is omitted, result is checked for null:
// Create an instance of Parser classusing(Parserparser=newParser("doc.zip")){// Extract a text from the document using(TextReaderreader=parser.GetText()){// Check if reader isn't nullif(reader==null){Console.WriteLine("Text extraction isn't supported");}else{Console.WriteLine(reader.ReadToEnd());}}}
This example prints “Text extraction isn’t supported” because there is no text in zip-archive.
Some operations may consume significant time. So it’s not optimal to call the method to just check the support for the feature. For this purpose Features property is used.
More resources
Advanced usage topics
To learn more about document data extraction features and get familiar how to extract text, images, forms and more, please refer to the advanced usage section.
GitHub examples
You may easily run the code above and see the feature in action in our GitHub examples: