IGR_Open_Stream¶
IGR_Open_Stream opens a document from a stream object for content extraction or enumeration of contained sub-documents.
Prototype¶
IGR_LONG IGR_Open_Stream(
IGR_Stream *Stream,
IGR_LONG Flags,
IGR_LONG* Capabilities,
IGR_LONG* DocType,
IGR_LONG* DocHandle,
Error_Control_Block* ISYSError);
Parameters¶
Stream: Pointer to an IGR_Stream (a stream object)
The stream can be either user implemented, or created using the IGR_Make_Stream_From_File and IGR_Make_Stream_From_Memory utility functions.
Flags: IGR_LONG
Specifies what type of data is returned from subsequent calls to the IGR_Get_Text function. These Open Document Flags affect the verbosity or the format of the extracted data.
Capabilities: Pointer to IGR_LONG
Returns the Document Capabilities as a bit field.
DocType: Pointer to IGR_LONG
Returns the Document Format Code of the document.
DocHandle: Pointer to IGR_LONG
Returns a handle to be used in subsequent calls.
ISYSError: Pointer to Error_Control_Block
Returns error details if the call fails.
¶
Return value¶
Success: IGR_LONG
Returns IGR_OK.
Failure: IGR_LONG
Returns one of the possible IGR_E error codes.
Sample code¶
Error_Control_Block ISYSError;
IGR_LONG Capabilities, DocType, DocHandle;
IGR_LONG RC = IGR_Open_Stream(pStream, IGR_BODY_AND_META, &Capabilities, &DocType, &DocHandle, &ISYSError);
if (RC == IGR_OK)
{
// Extract document text or sub-documents...
IGR_Close_File(DocHandle, &ISYSError);
}
Additional information¶
The call will establish a link to the document and populates a handle. The handle can be used to extract the text by calling IGR_Get_Text, generate page images with IGR_Open_Page, or enumerate and extract the sub-documents by calls to IGR_Get_Subfile_Entry and IGR_Extract_Subfile respectively.
The application must call IGR_Close_File when finished using the document.