Extract a text from images and PDFs

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Parser MCP server lets your agent work with files on your machine; they are never uploaded. It runs in Docker: replace /path/to/documents with the folder it may use.

claude mcp add groupdocs-parser -- docker run --rm -i -v /path/to/documents:/data ghcr.io/groupdocs-parser/parser-net-mcp:latest
Folders, licensing and more →

On this page

GroupDocs.Parser for .NET provides the ability to extract text from image files and PDFs composed of images.

Note
To use the OCR functionality in .NET Framework set PlatformTarget to x64. If downloadable (msi or zip) version of GroupDocs.Parser is used, see readme.txt file for the additional information.

It should be noted that not all languages ​​represented by the Language class are currently supported for recognition without implicitly downloading additional resources from the internet. However, if internet access is available, all necessary resources will be downloaded implicitly when selecting any recognition language. Currently supported languages ​​without additional downloads: English, Chinese, Japanese, Korean, Arabic.

The following example shows how to extract text from images and PDFs:

// Create an instance of Parser class
using (Parser parser = new Parser("scanned.pdf"))
{
    // Set OCR options
    TextOptions options = new TextOptions(false, true);
    options.OcrOptions = new OcrOptions();
    options.OcrOptions.Language = Language.Chinese;
    options.OcrOptions.PagePreviewOptions = new PagePreviewOptions();
    options.OcrOptions.PagePreviewOptions.Dpi = 144;
    // Extract text using OCR
    using(TextReader reader = parser.GetText(options))
    {
        // Print text or 'not supported' message
        Console.WriteLine(reader == null ? "Text extraction isn't supported" : reader.ReadToEnd());
    }
}

TextOptions can be omitted if the file is an image:

// Create an instance of Parser class
using (Parser parser = new Parser("scanned.jpg"))
{
    // Extract text using OCR
    using(TextReader reader = parser.GetText())
    {
        // Print text or 'not supported' message
        Console.WriteLine(reader == null ? "Text extraction isn't supported" : reader.ReadToEnd());
    }
}

On this page