3.9 Page
The page-level APIs in the page module enable creating, releasing, and flattening a page, setting page properties and actions, and more. Users need to call ZSDoc_AcquirePage to get a page object and clean it with ZSPage_Release. Here are some common page-level APIs listed in Table
3.10. For a complete list of APIs, please refer to ZSPage.h.
Table 3.10
|
API Name |
Description |
1 |
ZSPage_GetIndex |
Get page index. |
2 |
ZSPage_Create |
Create a new page to a position specified by the index. |
3 |
ZSPage_Release |
Release a page from document. |
4 |
ZSPage_Flatten |
Flatten a PDF page. You can no longer interact with form fields and annotations. |
5 |
ZSPage_GetRotation |
Get page rotation. |
6 |
ZSPage_GetMatrix |
Get page transformation matrix. |
7 |
ZSPage_DoJavaScriptAction |
Run a JavaScript action specified by the trigger.
*A JavaScript action is created by ZSActionData_Init and inserted into a page using ZSPage_InsertAction. |
8 |
ZSPage_SetAction |
Set a page trigger action. |
9 |
ZSPage_RemoveAllActions |
Remove a page trigger action. |
The following two examples demonstrate how to work with PDF pages using APIs.
Example 1: Get the page size
ZSFloat width = 0, height = 0;
Ret = ZSPage_GetSize(page, &width, &height);
|
Example 2: Create a page and set the size of it
ZSPage page = NULL;
if (ZS_OK == ZSPage_Create(doc, 0, &page))
{
ret = ZSPage_SetSize(page, PageWidth, PageHeight);
}
ZSPage_Release(page);
|
The page-level APIs in the page module enable creating, releasing, and flattening a page, setting page properties and actions, and more. Users need to call ZSDoc_AcquirePage to get a page object and clean it with ZSPage_Release. Here are some common page-level APIs listed in Table
3.10. For a complete list of APIs, please refer to ZSPage.h.
Table 3.10
|
API Name |
Description |
1 |
ZSPage_GetIndex |
Get page index. |
2 |
ZSPage_Create |
Create a new page to a position specified by the index. |
3 |
ZSPage_Release |
Release a page from document. |
4 |
ZSPage_Flatten |
Flatten a PDF page. You can no longer interact with form fields and annotations. |
5 |
ZSPage_GetRotation |
Get page rotation. |
6 |
ZSPage_GetMatrix |
Get page transformation matrix. |
7 |
ZSPage_DoJavaScriptAction |
Run a JavaScript action specified by the trigger.
*A JavaScript action is created by ZSActionData_Init and inserted into a page using ZSPage_InsertAction. |
8 |
ZSPage_SetAction |
Set a page trigger action. |
9 |
ZSPage_RemoveAllActions |
Remove a page trigger action. |
The following two examples demonstrate how to work with PDF pages using APIs.
Example 1: Get the page size
ZSFloat width = 0, height = 0;
Ret = ZSPage_GetSize(page, &width, &height);
|
Example 2: Create a page and set the size of it
ZSPage page = NULL;
if (ZS_OK == ZSPage_Create(doc, 0, &page))
{
ret = ZSPage_SetSize(page, PageWidth, PageHeight);
}
ZSPage_Release(page);
|