Name
doc:SetPagesConfiguration -- set maximum number of pages
Synopsis
status = doc:SetPagesConfiguration(page_per_pages)
Function
In the default setting, a document object has one "Pages" object as root of pages. All "Page" objects are created as children of the "Pages" object. Since a "Pages" object can own only 8191 children objects, the maximum number of pages are 8191 pages. Additionally, the state that there are a lot of "Page" object under one "Pages" object is not good, because it causes performance degradation of a viewer application.

An application can change the setting of a pages tree by invoking doc:SetPagesConfiguration(). If page_per_pages parameter is set to more than zero, a two-tier pages tree is created. A root "Pages" object can own 8191 "Pages" object, and each lower "Pages" object can own page_per_pages "Page" objects. As a result, the maximum number of pages becomes 8191 * page_per_pages page. An application cannot invoke doc:SetPagesConfiguration() after a page is added to document.

When doc:SetPagesConfiguration() succeeds, it returns #HPDF_OK. Otherwise, it returns an error code and the error handler is called.

Inputs
page_per_pages
specify the numbers of pages that a "Pages" object can own.
Results
status
status code
Errors
#HPDF_INVALID_DOCUMENT - An invalid document handle is set.

#HPDF_INVALID_DOCUMENT_STATE - A page object already exists in a document.

#HPDF_FAILED_TO_ALLOC_MEM - Memory allocation failed.


Show TOC