Skip to content

IGR_Get_Page_Annotations

IGR_Get_Page_Annotations copies references of page annotations into the user supplied array. The caller can iterate over all the page annotations by incrementing the Index parameter. For Office documents, comments will be extracted and returned in the page annotations array. For comments spanning multiple pages, the OFFICE_COMMENT_PAGE open document option determines if the first, last or all pages containing the comments should return an annotation.

Prototype

IGR_LONG IGR_Get_Page_Annotations (
    HPAGE Page,
    IGR_LONG Index,
    IGR_LONG* Count,
    IGR_Annotation* Items,
    Error_Control_Block* Error);

Parameters

PageHandle: HPAGE

Handle to a page, opened by a call to IGR_Open_File.

Index: IGR_LONG

Offset of the first form element to return, 0 based.

Count: Pointer to IGR_LONG

Prior to the call: Set to the number of IGR_Annotation structures pointed to by the Items buffer.

After the call: Returns the number of items copied into the Items buffer.

Items: Pointer to IGR_Annotation

Pointer to a user allocated array of IGR_Annotation structures to be filled.

Error: 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 Error;
IGR_LONG Capabilities, DocType, DocHandle, PageHandle;

IGR_LONG RC = IGR_Open_File(_UCS2("TEST.DOC"), IGR_FORMAT_IMAGE, &Capabilities, &DocType, &DocHandle, &Error);

if (RC == IGR_OK)
{
    IGR_LONG PageCount;
    if (IGR_Get_Page_Count(DocHandle, &PageCount, &Error) == IGR_OK)
    {
        for (IGR_LONG i = 0; i < PageCount; i++)
        {
            if (IGR_Open_Page(DocHandle, i, &PageHandle, &Error) == IGR_OK)
            {
                IGR_LONG AnnotationCount = 0;
                IGR_Get_Page_Annotation_Count(PageHandle, &AnnotationCount, &Error);

                for (IGR_LONG j = 0; j < AnnotationCount; j++)
                {
                    IGR_LONG read = 1;
                    IGR_Annotation annotation;

                    if (IGR_Get_Page_Annotations(PageHandle, j, &read, &annotation,
                        &Error) == IGR_OK)
                    {
                        // ….
                    }
                }

                IGR_Close_Page(PageHandle, &ISYSError);
            }
        }
    }
}

See also