Line class

 

 

Deprecated. The Line Class holds a line of text and its outline box as returned to The Bing Optical Character Recognition (OCR) Control by the Bing OCR Service. A Line is always returned as part of a list of Lines within an OcrResult object.

Published date: March 4, 2014

Warning

The Bing OCR Control is deprecated as of March 12, 2014.

Syntax

public sealed class Line

The Line class has the following members.

Properties

Name

Description

Box

Rect. A rectangle around the current line of text.

Words

IReadOnlyList<Word>. A list of Word objects that comprise the current line of text.

Example

The following code example enumerates through the text of an OCR result and writes to a string, preserving line breaks. It then writes the string to a TextBlock named tbResults.

private void OCR_OcrCompleted(object sender, OcrCompletedEventArgs e)
{
    // Make sure there is text.
    if (e.Result.Lines.Count == 0)
    {
        tbResults.Text = "No text found.";
        return;
    }

    // Read the text and print it to tbResults.
    string s = "";
    foreach (
            Line l in e.Result.Lines)
    {
        foreach (Word w in 
            l.Words)
        {
            s += w.Value + " ";
        }
        s += "\n";
    }
    tbResults.Text = s;
}

Requirements

Minimum Supported Client

Windows 8.1

Required Extensions

Bing OCR

Namespace

Bing.Ocr