|
Haru Free PDF Library
|
Functions | |
| HPDF_Doc | HPDF_NewEx (HPDF_Error_Handler user_error_fn, HPDF_Alloc_Func user_alloc_fn, HPDF_Free_Func user_free_fn, HPDF_UINT mem_pool_buf_size, void *user_data) |
| Create an instance of a document object and initialize it. More... | |
| HPDF_Doc | HPDF_New (HPDF_Error_Handler user_error_fn, void *user_data) |
| Create an instance of a document object and initialize it. More... | |
| HPDF_STATUS | HPDF_SetErrorHandler (HPDF_Doc pdf, HPDF_Error_Handler user_error_fn) |
| Set a user-defined error handler for document. If subsequent function calls fail, the error handler is called. More... | |
| void | HPDF_Free (HPDF_Doc pdf) |
| Revoke a document object and all resources. More... | |
| HPDF_STATUS | HPDF_NewDoc (HPDF_Doc pdf) |
Create a new document. If doc object already has a document, the current document is revoked. More... | |
| void | HPDF_FreeDoc (HPDF_Doc pdf) |
| Revoke the current document. More... | |
| HPDF_BOOL | HPDF_HasDoc (HPDF_Doc pdf) |
| Check if document handle is valid. More... | |
| void | HPDF_FreeDocAll (HPDF_Doc pdf) |
| Revoke the current document. More... | |
| HPDF_STATUS | HPDF_SaveToStream (HPDF_Doc pdf) |
| Saves the current document to a temporary stream of a document object. More... | |
| HPDF_UINT32 | HPDF_GetStreamSize (HPDF_Doc pdf) |
| Gets the size of the temporary stream of the document. More... | |
| HPDF_STATUS | HPDF_ReadFromStream (HPDF_Doc pdf, HPDF_BYTE *buf, HPDF_UINT32 *size) |
Copies the data from the temporary stream of the document into buffer buf. More... | |
| HPDF_STATUS | HPDF_ResetStream (HPDF_Doc pdf) |
| Rewind temporary stream of the document. More... | |
| HPDF_STATUS | HPDF_SaveToFile (HPDF_Doc pdf, const char *filename) |
| Saves the current document to file. More... | |
| HPDF_STATUS | HPDF_SetPagesConfiguration (HPDF_Doc pdf, HPDF_UINT page_per_pages) |
Specify number of pages Pages object can own. More... | |
Document routines are functions for document creation, freeing, substitution and reading/saving.
| void HPDF_Free | ( | HPDF_Doc | ) |
Revoke a document object and all resources.
| Document object handle. |
| void HPDF_FreeDoc | ( | HPDF_Doc | ) |
Revoke the current document.
HPDF_FreeDoc() keeps and recycles loaded resources (such as fonts and encodings) when new document requires these resources.
| Document object handle. |
| void HPDF_FreeDocAll | ( | HPDF_Doc | ) |
Revoke the current document.
HPDF_FreeDocAll() revokes the current document and all resources.
| Document object handle. |
| HPDF_UINT32 HPDF_GetStreamSize | ( | HPDF_Doc | ) |
Gets the size of the temporary stream of the document.
| Document object handle. |
Check if document handle is valid.
| Document object handle. |
| HPDF_Doc HPDF_New | ( | HPDF_Error_Handler | user_error_fn, |
| void * | user_data | ||
| ) |
Create an instance of a document object and initialize it.
| user_error_fn | User-defined error handler which is invoked when an error occurred. |
| user_data | User-defined void pointer. This pointer is used by error handling. |
NULL on failure.| HPDF_STATUS HPDF_NewDoc | ( | HPDF_Doc | ) |
Create a new document. If doc object already has a document, the current document is revoked.
| Document object handle. |
| HPDF_Doc HPDF_NewEx | ( | HPDF_Error_Handler | user_error_fn, |
| HPDF_Alloc_Func | user_alloc_fn, | ||
| HPDF_Free_Func | user_free_fn, | ||
| HPDF_UINT | mem_pool_buf_size, | ||
| void * | user_data | ||
| ) |
Create an instance of a document object and initialize it.
| user_error_fn | User-defined error handler which is invoked when an error occurred. |
| user_alloc_fn | User-defined memory allocation function. If NULL is specified, malloc() is used. |
| user_free_fn | User-defined memory freeing function. If NULL is specified, free() is used. |
| mem_pool_buf_size |
A memory allocation function is called on demand from an application. If this parameter set to non-zero value, memory management will be done as following:
|
| user_data | User-defined void pointer. This pointer is used by error handling. |
NULL on failure.| HPDF_STATUS HPDF_ReadFromStream | ( | HPDF_Doc | pdf, |
| HPDF_BYTE * | buf, | ||
| HPDF_UINT32 * | size | ||
| ) |
Copies the data from the temporary stream of the document into buffer buf.
| Document object handle. | |
| buf | Pointer to the buffer. |
| size | The size of buffer. After HPDF_ReadFromStream() is executed, the number of bytes read is set into size. |
size parameter is more than 0, data is read into the buffer. | HPDF_STATUS HPDF_ResetStream | ( | HPDF_Doc | ) |
Rewind temporary stream of the document.
| Document object handle. |
| HPDF_STATUS HPDF_SaveToFile | ( | HPDF_Doc | pdf, |
| const char * | filename | ||
| ) |
Saves the current document to file.
| Document object handle. | |
| filename | The name of file to save. |
| HPDF_STATUS HPDF_SaveToStream | ( | HPDF_Doc | ) |
Saves the current document to a temporary stream of a document object.
| Document object handle. |
| HPDF_STATUS HPDF_SetErrorHandler | ( | HPDF_Doc | pdf, |
| HPDF_Error_Handler | user_error_fn | ||
| ) |
Set a user-defined error handler for document. If subsequent function calls fail, the error handler is called.
| Document object handle. | |
| user_error_fn | User-defined error handler. If NULL, previous error handler is revoked. |
| HPDF_STATUS HPDF_SetPagesConfiguration | ( | HPDF_Doc | pdf, |
| HPDF_UINT | page_per_pages | ||
| ) |
Specify number of pages Pages object can own.
In the default setting, a HPDF_Doc object has one Pages object as root of pages. All Page objects are created as a child of Pages object. Since Pages object can own only 8191 child objects, the maximum number of pages are 8191 pages. Additionally, the case when there are a lot of "Page" object under one "Pages" object is not good, since it causes performance degradation of a viewer application.
An application can change the setting of a pages tree by invoking HPDF_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 pages. An application cannot invoke HPDF_SetPageConfiguration() after a page is added to document.
| Document object handle. | |
| page_per_pages | Numbers of pages Pages object can own. |