Skip to content

IGR_Get_Image_Entry

IGR_Get_Image_Entry enumerates the set of images, when HTML or Image conversion is in affect.

Prototype

IGR_LONG IGR_Get_Image_Entry(
    IGR_LONG DocHandle,
    IGR_UCS2* ID,
    IGR_UCS2* Name,
    LONGLONG* FileDate,
    LONGLONG* FileSize,
    Error_Control_Block* ISYSError);

Parameters

DocHandle: IGR_LONG

Is a handle to a file, opened by a call to IGR_Open_File.

ID: Unicode string (UCS2)

Application allocated memory block of 8192 bytes that will be filled with up to 4096 Unicode characters that specify the unique ID of the next sub-document.

Name: Unicode string (UCS2)

Application allocated memory block of 2048 bytes that will be filled with up to 1024 Unicode characters that specify the name of the sub-document.

FileDate: Pointer to INT64

Returns the date and time of the sub-document in FILETIME format.

FileSize: Pointer to INT64

Returns the size in bytes of the sub-document.

ISYSError: Pointer to Error_Control_Block

Returns error details if the call fails.

Return value

Success: IGR_LONG

Returns IGR_OK.

Success and the end of the document was reached: IGR_LONG

Returns IGR_NO_MORE.

Failure: IGR_LONG

Returns one of the possible IGR_E error codes.

Sample code

Error_Control_Block ISYSError;
IGR_LONG Capabilities, DocType, DocHandle;
IGR_UCS2 ID[4096], Name[1024];
INT64 FileDate, FileSize;

IGR_LONG RC = IGR_Open_File_Ex(_UCS2("TEST.DOC"), IGR_BODY_AND_META | IGR_FORMAT_HTML, _UCS2(""), &Capabilities, &DocType, &DocHandle, &ISYSError);
if (RC == IGR_OK)
{
    // Extract document HTML via IGR_Get_Text first, then...
    while (true)
    {
        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(DocHandle, ID, ID, &ISYSError);
        if (rc != IGR_OK)
            // ReportError(rc);
    }
    IGR_Close_File(DocHandle, &ISYSError);
}

Additional information

The previously opened document must have the IGR_FILE_SUPPORTS_HDHTML capability.

After a successful call to IGR_Open_File / Stream, each call to IGR_Get_Image_Entry will retrieve information about the images contained in the document, referenced by DocHandle. To traverse all the images, the application will need to call this method in a loop until IGR_NO_MORE is returned.

Note that the null-terminating character will also be copied to the ID and Name parameters. If the function succeeds, the ID is guaranteed not to be empty and will be unique among all traversed images retrieved from the document. The returned ID can be used in a call to IGR_Extract_Image to save the binary content of the image to disk.