Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active September 30, 2019 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/1abb5d9bf8336ff30a9791636e9eda3c to your computer and use it in GitHub Desktop.
Save GroupDocsGists/1abb5d9bf8336ff30a9791636e9eda3c to your computer and use it in GitHub Desktop.
// Create an instance of Parser class
using (Parser parser = new Parser(filePath))
{
// Extract text to the reader
using (TextReader reader = parser.GetText())
{
// Check if text extraction is supported
if (reader == null)
{
Console.WriteLine("Text extraction isn't supported.");
return;
}
string textLine = null;
do
{
textLine = reader.ReadLine();
if (textLine != null)
{
Console.WriteLine(textLine);
}
}
while (textLine != null);
}
}
// Create an extractor factory
ExtractorFactory factory = new ExtractorFactory();
// Create a text extractor
using (TextExtractor extractor = factory.CreateTextExtractor(filePath))
{
// Extract text from the text extractor
string textLine = null;
do
{
textLine = extractor.ExtractLine();
if (textLine != null)
{
Console.WriteLine(textLine);
}
}
while (textLine != null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment