Skip to content

Extractor::EOF property

The EOF property is only valid for documents where the SupportsText property is TRUE. The EOF property will be set to TRUE when no more text can be extracted from the document with calls to GetText. If the document needs to be re-read, call Close and Open first.

bool EndOfStream { get; }
boolean getEOF() throws IGRException;
@property
def EOF(self) -> bool
bool getEOF() const;
[propget] HRESULT EOF([out, retval] VARIANT_BOOL *result);

Return Value

bool : Indicates if more text can be read from the file.

Sample Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
using Hyland.DocumentFilters;
using System;

var api = new Hyland.DocumentFilters.Api(); // (1) Create an instance of the API and initialize it
api.Initialize("YOUR_LICENSE_KEY_HERE", ".");

using var doc = api.GetExtractor("filename.doc"); // (2) Create an instance of the Extractor for a file

doc.Open(Hyland.DocumentFilters.OpenType.BodyAndMeta); // (3) Open the document for reading in text-mode

while (!doc.EndOfStream) // (4) Read the document in 4KB chunks and write it to the console
{
    var text = doc.GetText(4096);
    Console.Out.WriteLine(text);
}

doc.Close();
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import com.perceptive.documentfilters.*;

public class App
{
    public static void main(String[] args) throws Exception
    {
        DocumentFilters df = new DocumentFilters();
        df.Initialize("YOUR_LICENSE_KEY_HERE", ".");

        try (Extractor doc = df.GetExtractor("filename.doc")) {
            doc.Open(isys_docfilters.IGR_BODY_AND_META);

            while (!doc.getEOF()) {
                string text = doc.GetText(4096);
                System.out.println(text);
            }
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from DocumentFilters import *

api = DocumentFilters()
api.Initialize("YOUR_LICENSE_KEY_HERE", ".")

with api.GetExtractor("filename.doc") as doc:
    doc.Open(IGR_BODY_AND_META, "")

    while not doc.getEOF():
        output.write(doc.GetText(MaxCharsPerGetText, stripControlCodes=True))
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <string>
#include "DocumentFiltersObjects.h"

int main() {
    try {
        // Create a DocumentFilters object (Api is an alias for DocumentFilters)
        Hyland::DocFilters::Api api;

        // Initialize the DocumentFilters object with license and path
        std::string license = "YOUR_LICENSE_KEY_HERE";
        std::string path = "."; 
        api.Initialize(license, path); 

        // Get an extractor for the specified file
        Hyland::DocFilters::Extractor doc = api.GetExtractor("filename.doc"); 

        // Open the document with BodyAndMeta flag
        doc.Open(Hyland::DocFilters::OpenMode::Text, IGR_BODY_AND_META); 

        // Read and print the text content
        while (!doc.getEOF()) { 
            std::wstring text = doc.getText(4096);
            std::wcout << text << std::endl;
        }

        // Close the document
        doc.Close(); 

    } catch (const std::exception& ex) {
        std::cerr << "Error: " << ex.what() << std::endl;
    }
    return 0;
}

Additional Information

Accessing this property will open the document. Call the Close method when finished.

See Also