TextDevice.Process

TextDevice.Process method

Convert page and save it as text stream.

public override void Process(Page page, Stream output)
ParameterTypeDescription
pagePageThe page to convert.
outputStreamResult stream.

Examples

The example demonstrates how to extract text on the first PDF document page.

Document doc = new Document(inFile);
string extractedText;

using (MemoryStream ms = new MemoryStream())
{
    // create text device
    TextDevice device = new TextDevice();

    // convert the page and save text to the stream
    device.Process(doc.Pages[1], ms);

    // use the extracted text
    ms.Close();
    extractedText = Encoding.Unicode.GetString(ms.ToArray());
}

See Also