using System; using System.Collections.Generic; using System.Text; using System.IO; using GroupDocs.Parser; using GroupDocs.Parser.Data; namespace ExtractTextFromHtmlInCSharp { class Program { public static void Main(string[] args) // Main function to extract text from HTML using C# { // Remove the watermark in output string licensePath = "GroupDocs.Parser.lic"; GroupDocs.Parser.License lic = new GroupDocs.Parser.License(); lic.SetLicense(licensePath); // Create an instance of Parser class using (Parser parser = new Parser("sample.html")) { // Extract a text into the reader using(TextReader reader = parser.GetText()) { // Print a text from the document // If text extraction isn't supported, a reader is null Console.WriteLine(reader == null ? "Text extraction isn't supported" : reader.ReadToEnd()); } } } } }