Skip to content

IGR_Extract_Image_Stream

IGR_Extract_Image_Stream extracts an image to a stream from a document, given the ID of the image.

The image ID is obtained previously by IGR_Get_Image_Entry from the document, after being opened by IGR_Open_File or IGR_Open_Stream with the HTML conversion Open Document Flags set.

Prototype

IGR_LONG IGR_Extract_Image_Stream(
    IGR_LONG DocHandle,
    const IGR_UCS2* ID,
    IGR_Stream **Stream,
    Error_Control_Block* ISYSError);

Parameters

DocHandle: IGR_LONG

Handle to a document, opened by a call to IGR_Open_File, IGR_Open_File_Ex, IGR_Open_Stream or IGR_Open_Stream_Ex.

ID: Unicode string (UCS2)

Unique ID of the sub-document to be extracted, obtained by a call to IGR_Get_Image_Entry.

Stream: IGR_Stream **

A pointer to a system allocated memory stream will be returned.

It is the caller’s responsibility to free the stream object by calling Stream->Close().

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_Stream *Stream;
IGR_UCS2 ID[4096], Name[1024];
INT64 FileDate, FileSize;

while (true)
{
    IGR_LONG rc = IGR_Get_Image_Entry(DocHandle, ID, Name, &FileDate, &FileSize, &ISYSError);
    if (rc != IGR_OK)
    {
        if (rc != IGR_NO_MORE)
            // ReportError(rc);
        break;
    }
    rc = IGR_Extract_Image_Stream(DocHandle, ID, &Stream, &ISYSError);
    if (rc != IGR_OK)
        // ReportError(rc);
    else
        // DoSomethingWithTheStream(Stream);
    Stream->close();
}

See also