ImageGear for C and C++ on Linux v18.10 - Updated
IG_PDF_doc_page_release
API Reference Guide > PDF Component API Reference > PDF Component Objects Reference > General Objects > HIG_PDF_DOC > IG_PDF_doc_page_release

This function decrements the reference count for a PDF page.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_PDF_doc_page_release(
        HIG_PDF_PAGE hPage
);

Arguments:

Name Type Description
hPage HIG_PDF_PAGE The page to release.

Return Value:

The number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

This function does not process image pixels.

Remarks:

Applications that obtain an HIG_PDF_PAGE from IG_PDF_doc_get_page are required to invoke this function to decrement that PDF page's reference count and release the HIG_PDF_PAGE instance. This ensures that the PDF document can successfully close.

For example:

 
Copy Code
const AT_INT FIRST_PAGE = 0 ;

HMIGEAR higDoc = 0 ;
HIG_PDF_DOC hPdfDoc = 0 ;
HIG_PDF_PAGE hPdfPage = 0 ;
UINT annotation_count = (UINT)-1 ; 

// Recover number of annotations on first PDF page
IG_mpi_create( &higDoc , 0 ) ;
IG_mpi_file_open( "sample.pdf" , higDoc, IG_FORMAT_PDF , IG_MP_OPENMODE_READWRITE ) ;
IG_mpi_info_get( higDoc, IG_MP_DOCUMENT, &hPdfDoc, sizeof( hPdfDoc ) ) ;

IG_PDF_doc_get_page( hPdfDoc, FIRST_PAGE, &hPdfPage ) ;
IG_PDF_page_get_annotation_count( hPdfPage , &annotation_count ) ;
IG_PDF_doc_page_release( hPdfPage ) ;

IG_mpi_delete( higDoc ) ;

Applications that obtain an HIG_PDF_PAGE from IG_vector_data_get should instead use IG_mpi_delete. The HMIGEAR retains ownership of HIG_PDF_PAGE and is responsible for releasing it.

For example:

 
Copy Code
const AT_INT FIRST_PAGE = 0 ;

HMIGEAR higDoc = 0 ;
HIGEAR higPage = 0 ;
HIG_PDF_PAGE hPdfPage = 0 ;
AT_ERRCOUNT errCount = 0 ;
UINT annotation_count = (UINT)-1 ; 

// Recover number of annotations on the first PDF page
IG_mpi_create( &higDoc , 0 ) ;
IG_mpi_file_open( "sample.pdf" , higDoc, IG_FORMAT_PDF , IG_MP_OPENMODE_READWRITE ) ;
IG_mpi_page_get( higDoc , FIRST_PAGE , &higPage ) ;

IG_vector_data_get( higPage, ( LPVOID* )&hPdfPage ) ;
IG_PDF_page_get_annotation_count( hPdfPage , &annotation_count ) ;

IG_mpi_delete( higDoc ) ;